﻿#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cjt188_api_04.h"



#ifdef CJT188_DEBUG_ON



INT32 g_need_pack_07 = CJT188_OFF;
char g_out_data_07[OUT_BUF_LEN] = {0};

#endif

// 数据域长度
#define CJT188_DATA_LEN_METER_PROG         50
#define CJT188_DATA_LEN_RECD_METER_CLEAR   106
#define CJT188_DATA_LEN_RECD_DEAMD_CLEAR     202



/*************************************************
Function:       cjt188_str_to_num
Description:   将长度为len的string转为数字转出
Calls:          
Called By:      
Input:          

Output:        

Return:        
Others:     

*************************************************/
INT32 cjt188_str_to_num(char* str, INT32 len)
{
    char buf[10] = {0};
    INT32 i;

    if(len > 10)
    {
        return -1;
    }
    
    for(i = 0; i < len; i++)
    {
        buf[i] = str[i];        
    }
    
    return atoi(buf);
}

/*****************************************************************************
 函 数 名  : cjt188_hex_str_to_long
 功能描述  : 将长度为len的内容，当作十六进制字符串，将为长整数
 输入参数  : char*str  
             INT32 len   
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月23日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
long cjt188_hex_str_to_long(char*str, INT32 len)
{
    long lRet = 0;
    INT32 i = 0;
    char buf[9]= {0};
    
    if(len > 8 || len <= 0)
    {
        return 0xFFFFFFFF;
    }
    
    for(i = 0; i < len; i++)
    {
        buf[i] = str[i];
    }

    lRet = strtol(buf,NULL, 16);
    return lRet;
}

static void str2bcd(char *str,UINT8 *BCD,INT32 *BCD_length)
{
    INT32 i = 0,j = 0,sLen;
    INT32 tmp=strlen(str);

    if(str==0) 
    {
        return;
    }
    
    sLen = tmp;
    tmp-=tmp%2;

    for(i=0;i<tmp;i++)
     {
         if(str==0 ||
             !((str[i]>='0' && str[i]<='9' )|| (str[i]>='a' && str[i]<='f') || (str[i]>='A' && str[i]<='F')))
            
             return;
     }
     
   // for(i=0,j=0;i<tmp/2;i++,j+=2) 
    for(i=0,j=sLen-1;i<tmp/2;i++,j-=2)
     {
        // (str[j] > '9') ? (str[j]>'F' ? BCD[i]=str[j]-'a'+10 : BCD[i]=str[j]-'A'+10):( BCD[i]=str[j]-'0');
            if(str[j] > '9')   
            {
                if(str[j]>'F')
                {
                    BCD[i]=str[j]-'a'+10;
                }
                else
                {
                    BCD[i]=str[j]-'A'+10;
                }
            }
            else
            {
                BCD[i]=str[j]-'0';
            }
            
            if(str[j-1]>'9')
            {
                if(str[j+1]>'F')
                {
                    BCD[i]=(BCD[i]<<4)+str[j+1]-'a'+10;
                }
                else
                {
                     BCD[i]=(BCD[i]<<4)+str[j+1]-'A'+10;
                }
            }
            else
            {
                BCD[i]=(BCD[i]<<4)+str[j+1]-'0';
            }
       //   ?  (str[j+1]>'F' ? BCD[i]=(BCD[i]<<4)+str[j+1]-'a'+10 : BCD[i]=(BCD[i]<<4)+str[j+1]-'A'+10)
           // : BCD[i]=(BCD[i]<<4)+str[j+1]-'0';        
     }
     if(BCD_length)
         *BCD_length=tmp/2;
    return;    
}

/*************************************************
Function:       get_cjt188_ruler_id
Description:    通过规约类型获得对应规约ID

Author:         liming 

Calls:          
Called By:      
Input:           E_CJT188_RULER_TYPE type,
                 S_CJT188_RULER_PARA para,
                
Output:          UINT32 rulerID 规约ID
Return:         正确返回 0 其它为错误类型

Others:         重要函数，规约解析核心函数
  
*************************************************/
INT32 get_cjt188_ruler_id(E_CJT188_RULER_TYPE type,
                     S_CJT188_RULER_PARA para,
                     UINT32 *poutRulerID)
{


    return E_CJT188_OK;
}


/*************************************************
Function:       pack_cjt188_frame_by_data
Description:    内部函数，仅完成结构体的填充

Author:         liming 

Calls:          
Called By:      
Input:          S_CJT188_PACK_FRAME *inPara 用于封帧数据
                
Output:         char *outBuffer 封装后的帧buffer
                INT32  *outLength 该帧总长
Return:         正确返回0

Others:         
  
*************************************************/
INT32 pack_cjt188_frame_by_data(S_CJT188_PACK_FRAME *inPara, char *outBuffer, INT32 *outLength)
{
    INT32 i;
    INT32 len = 0; /* 计算包的总字节长 */
    UINT8 ucCheckSum = 0;
    UINT8 ucDi0,ucDi1;
    UINT8 aucAddrTmp[CJT188_ADDR_LEN/2]; 
    
    if(NULL == outBuffer || NULL == inPara ||  NULL == outLength)
    {
        return E_CJT188_ERRO_NULL;
    }
    // 准备数据 
    ucDi0 = inPara->ruler_id & 0xFF;
    ucDi1 = (inPara->ruler_id >> 8) & 0xFF;

    cjt188_str2bcd(inPara->address, aucAddrTmp, CJT188_ADDR_LEN/2);

    /* 开始封帧 */
    // 1 帧起始符
    outBuffer[len++] = 0x68; 

    // 2 表类型
    outBuffer[len++] = inPara->type; 

    // 3 地址域 
    for(i = 0; i < CJT188_ADDR_LEN/2; i++)
    {
        outBuffer[len++] = aucAddrTmp[i];
    }

    // 4 控制码
    outBuffer[len++] = inPara->ctrl_code; 

    // 5 数据域字节数
    outBuffer[len++] = inPara->data_len;
    //printf("len = %d\n", inPara->data_len);

    // 6 规约ID  - 以下数据域 逐字节加0x33
    outBuffer[len++] = ucDi0;
    outBuffer[len++] = ucDi1;

    // SER
    outBuffer[len++] = 0;

    // 7 其它数据
    for(i = 0; i < inPara->data_len - 3; i++)
    {
       outBuffer[len++] = inPara->data[i];
    }

    // 8 计数检验和
    for(i = 0; i < len; i++)
    {
        ucCheckSum += outBuffer[i];
    }

    // 9 检验和
    outBuffer[len++] = ucCheckSum;

    // 10 结束符
    outBuffer[len++] = 0x16;

    /* 输出参数 */
    *outLength = len;

    return E_CJT188_OK;
}



/*************************************************
Function:       pack_cjt188_frame_by_data
Description:    内部函数，仅完成结构体的填充

Author:         liming 

Calls:          
Called By:      
Input:          S_CJT188_PACK_FRAME *inPara 用于封帧数据
                
Output:         char *outBuffer 封装后的帧buffer
                INT32  *outLength 该帧总长
Return:         正确返回0

Others:         
  
*************************************************/
INT32 pack_cjt188_frame_for_ctrl_comm(S_CJT188_PACK_FRAME *inPara, char *outBuffer, INT32 *outLength)
{
    INT32 i;
    INT32 len = 0; /* 计算包的总字节长 */
    UINT8 ucCheckSum = 0;
    UINT8 aucAddrTmp[CJT188_ADDR_LEN/2]; 
    
    if(NULL == outBuffer || NULL == inPara ||  NULL == outLength)
    {
        return E_CJT188_ERRO_NULL;
    }

    cjt188_str2bcd(inPara->address, aucAddrTmp, CJT188_ADDR_LEN/2);

    /* 开始封帧 */
    // 1 帧起始符
    outBuffer[len++] = 0x68; 

    // 2 表类型
    outBuffer[len++] = inPara->type; 

    // 3 地址域 
    for(i = 0; i < CJT188_ADDR_LEN/2; i++)
    {
        outBuffer[len++] = aucAddrTmp[i];
    }

    // 4 控制码
    outBuffer[len++] = inPara->ctrl_code; 

    // 5 数据域字节数
    outBuffer[len++] = inPara->data_len;
    //printf("len = %d\n", inPara->data_len);
  
    // 6 其它数据
    for(i = 0; i < inPara->data_len; i++)
    {
       outBuffer[len++] = inPara->data[i];
    }

    // 7 计数检验和
    for(i = 0; i < len; i++)
    {
        ucCheckSum += outBuffer[i];
    }

    // 8 检验和
    outBuffer[len++] = ucCheckSum;

    // 9 结束符
    outBuffer[len++] = 0x16;

    /* 输出参数 */
    *outLength = len;

    return E_CJT188_OK;
}


/*************************************************
Function:       trans_cjt188ctrl_char2struct
Description:    解析将代表它的字节值转化控制码结构输出
                
Author:         liming 

Calls:          
Called By:      
Input:          S_CJT188_CTRL_CODE *inStruct

Output:         UINT8 *outChar
Return:      

Others:        反转换 trans_cjt188ctrl_struct2char
  
*************************************************/
eCJT188Err trans_cjt188ctrl_char2struct(UINT8 inChar,  S_CJT188_CTRL_CODE *outStruct)
{
    UINT8 ucCtrlCode = inChar;
    INT32 func_code = 0;

    if(NULL == outStruct)
    {
        return E_CJT188_ERRO_NULL;
    }

    if((ucCtrlCode & 0x80) == 0)
    {
        outStruct->direct = E_CJT188_CTRL_DIR_M2S;
    }
    else
    {
        outStruct->direct = E_CJT188_CTRL_DIR_S2M;
    }

    if((ucCtrlCode & 0x40) == 0)
    {
        outStruct->reply = E_CJT188_CTRL_SR_OK;
    }
    else
    {
        outStruct->reply = E_CJT188_CTRL_SR_NO;
    }

    func_code = ucCtrlCode & 0x3F;

    switch(func_code)
    {
        case CJT188_CTRL_RESV:
            outStruct->funcode = E_CJT188_CTRL_RESV;
            break;
            
        case CJT188_CTRL_READ_DATA:
            outStruct->funcode = E_CJT188_CTRL_READ_DATA;
            break;
            
        case CJT188_CTRL_READ_ADDR:
            outStruct->funcode = E_CJT188_CTRL_READ_ADDR;
            break;
            
        case CJT188_CTRL_WRITE_DATA:
            outStruct->funcode = E_CJT188_CTRL_WRITE_DATA;
            break;
            
        case CJT188_CTRL_WRITE_ADDR:
            outStruct->funcode = E_CJT188_CTRL_WRITE_ADDR;
            break;
        default:
            return E_CJT188_ERRO_PARA_OUT_RANGE;
            
    }

    return E_CJT188_OK;
}


/*************************************************
Function:       trans_cjt188ctrl_struct2char
Description:    解析控制码结构 将代码它的字节值输出
                
Author:         liming 

Calls:          
Called By:      
Input:          S_CJT188_CTRL_CODE *inStruct

Output:         UINT8 *outChar
Return:      

Others:        反转换 trans_cjt188ctrl_char2struct
  
*************************************************/
eCJT188Err trans_cjt188ctrl_struct2char(UINT8 *outChar, S_CJT188_CTRL_CODE *inStruct)
{
    UINT8 ucCtrlCode = 0;
    UINT8 ucD7,ucD6,ucD5,ucD50;

    if(NULL == outChar || NULL == inStruct)
    {
        return E_CJT188_ERRO_NULL;
    }

    ucD7 = inStruct->direct;
    ucD6 = inStruct->reply;
    ucD50 = inStruct->funcode;

    ucCtrlCode |= ucD7 << 7;
    ucCtrlCode |= ucD6 << 6;
    ucCtrlCode |= ucD50 & 0x3F;

    *outChar = ucCtrlCode;

    return E_CJT188_OK;
}


/*************************************************
Function:       unpack_cjt188_frame
Description:    解析cjt188 2007帧功能函数

Author:         liming 

Calls:          
Called By:      
Input:          inpBuffer      传入包有帧buffer指针
                inBufferLength 该buffer长度
                
Output:         outpFrame 该帧的各类详细信息

Return:         正确返回0

Others:         重要的功能函数
  
*************************************************/
INT32 unpack_cjt188_frame(void *inpBuffer, INT32 inBufferLength, S_CJT188_UNPACK *outpFrame)
{

    INT32 nNumber0xFE = 0;                     /* 前导字符的个数 */
    INT32 i = 0;
    INT32 pos = 0;
    INT32 nCheckSumPosStart, nCheckSumPos, nEndPos;
    INT32 ret = 0;
    UINT8 ucCtrlCode = 0;
    UINT8 ucDataLen = 0;
    UINT8 ucCheckSum = 0;
    UINT32 ulRulerID = 0;
    
    UINT8 *buffer = (UINT8 *)inpBuffer;

    char addr_bcd[CJT188_ADDR_LEN/2] = {0};                  //地址信息(BCD形式)
    char addr_str[CJT188_ADDR_LEN+1] = {0};         //地址信息(string形式)
    UINT8 aucDataTmp[CJT188_DATA_MAX];
    S_CJT188_RULER_INFO stRulerInfor = {0};
    F_CJT188_RULER_TRANS pTransFunc;    /* 解析函数指针 */

    if(NULL == inpBuffer || NULL == outpFrame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(inBufferLength < CJT188_FRAME_LEN_MIN)
    {
        return E_CJT188_ERRO_FRAME_UNCOMP;
    }

    for(i = 0; i < 4; i++)
    {
        if(0xFE == buffer[i])
        {
            pos++;
            nNumber0xFE++;
        }
    }
    
    nCheckSumPosStart = pos;

    // 检查前导字符 0x68
    if(0x68 != buffer[pos])
    {
        return E_CJT188_ERRO_FRAME_0x68;
    }

    //表类型
    pos++;

    //地址
    pos++;
    for(i = 0; i < CJT188_ADDR_LEN/2; i++)
    {
        addr_bcd[i] = buffer[pos++];
    }
    //地址
    cjt188_bcd2str(addr_bcd, addr_str, CJT188_ADDR_LEN/2);
    //控制码
    ucCtrlCode = buffer[pos++];
    // printf("\nCtrlCode = 0x%02X\n", ucCtrlCode);
    //转换控制码
    ret =  trans_cjt188ctrl_char2struct(ucCtrlCode, &(outpFrame->ctrl_s));
    if(E_CJT188_OK != ret)
    {
        return ret;
    }

    //数据域长度
    ucDataLen = buffer[pos++];
    nCheckSumPos = pos + ucDataLen;
    nEndPos = nCheckSumPos+1;

    for(i = 0; i < ucDataLen; i++)
    {
        aucDataTmp[i] = (buffer[pos++]); 
    }
    //查检checksum
    for(i = nCheckSumPosStart; i < nCheckSumPos; i++)
    {
        ucCheckSum +=  buffer[i];
    }


    if(ucCheckSum != buffer[nCheckSumPos])
    {
    
        return E_CJT188_ERRO_FRAME_CHECK_SUM;
    }

    //结束符
    if(0x16 != buffer[nEndPos])
    {
        return E_CJT188_ERRO_FRAME_END_0x16;
    }


    //地址
    for(i = 0; i < CJT188_ADDR_LEN; i++)
    {
        outpFrame->address[i] = addr_str[i];
        // printf("%d - %c \n",i, addr_str[i]);
    }

    // 正常的报文
    
    if(E_CJT188_CTRL_SR_OK == outpFrame->ctrl_s.reply)
    {    
        // 原数据 
        for(i = 3; i < ucDataLen; i++)
        {
            outpFrame->data_pack[i-3] = aucDataTmp[i];
        }

        // 规约ID
        ulRulerID = ((aucDataTmp[0] & 0xFF) | 
                    ((aucDataTmp[1] << 8) & 0xFF00));

        // 通过ID获取详细信息    
        ret = get_cjt188_ruler_info(ulRulerID, &stRulerInfor);

        if(E_CJT188_OK != ret)
        {
            return ret;
        }
        
        if(NULL == stRulerInfor.func)
        {
            outpFrame->flag    = E_CJT188_UNPD_FLG_FUNC_NULL;
        }
        else
        {

            if(ucDataLen > 3)
            {
                pTransFunc          = stRulerInfor.func;
                ret = pTransFunc(E_CJT188_TRANS_F2U, 
                                (void*)&(outpFrame->data_unpack),
                                (void*)&(outpFrame->data_pack));
              
                if(E_CJT188_OK == ret)
                {
                    outpFrame->flag    = E_CJT188_UNPD_FLG_OK;
                }
                else
                {
                    outpFrame->flag =  E_CJT188_UNPD_FLG_FUNC_ERROR;
                }
            }
            
        }

        outpFrame->data_len  = ucDataLen - 3;
    }
    else
    {
        for(i = 0; i < ucDataLen; i++)
        {
            outpFrame->data_pack[i] = aucDataTmp[i];
        }
        // 异常报文
        outpFrame->data_len  = ucDataLen;
        outpFrame->flag    = E_CJT188_UNPD_FLG_ERROR_OK;        
        ret = trans_cjt188_data_err(E_CJT188_TRANS_F2U, 
                    (void*)&(outpFrame->data_unpack),
                    (void*)&(outpFrame->data_pack));

        if(E_CJT188_OK == ret)
        {
            outpFrame->flag    = E_CJT188_UNPD_FLG_ERROR_OK;
        }
        else
        {
            outpFrame->flag =  E_CJT188_UNPD_FLG_FUNC_ERROR;
        }    
        
    
    }
    
    /* 封装输出最后信息 */
    outpFrame->lead_num  = nNumber0xFE;
    outpFrame->ctrl_c      = ucCtrlCode;
    outpFrame->ruler_id  = ulRulerID;
    
    outpFrame->frame_len = ucDataLen + 12;
    outpFrame->type      = stRulerInfor.type;
    outpFrame->format    = stRulerInfor.format;

    return E_CJT188_OK;
}


/*************************************************
Function:       unpack_cjt188_resp_frame
Description:    解析cjt188 2007 应答帧功能函数

Author:         liming 

Calls:          
Called By:      
Input:          inpBuffer      传入包有帧buffer指针
                inBufferLength 该buffer长度
                
Output:         outpFrame 该帧的各类详细信息

Return:         正确返回0

Others:         重要的功能函数
  
*************************************************/
INT32 unpack_cjt188_resp_frame(void *inpBuffer, INT32 inBufferLength, S_CJT188_UNPACK *outpFrame)
{

    INT32 nNumber0xFE = 0;                     /* 前导字符的个数 */
    INT32 i = 0;
    INT32 pos = 0;
    INT32 nCheckSumPosStart, nCheckSumPos, nEndPos;
    INT32 ret = 0;
    UINT8 ucCtrlCode = 0;
    UINT8 ucDataLen = 0;
    UINT8 ucCheckSum = 0;
    UINT32 ulRulerID = 0;
    
    UINT8 *buffer = (UINT8 *)inpBuffer;

    char addr_bcd[CJT188_ADDR_LEN/2] = {0};                  //地址信息(BCD形式)
    char addr_str[CJT188_ADDR_LEN+1] = {0};         //地址信息(string形式)
    UINT8 aucDataTmp[CJT188_DATA_MAX];
    S_CJT188_RULER_INFO stRulerInfor = {0};
    F_CJT188_RULER_TRANS pTransFunc;    /* 解析函数指针 */

    if(NULL == inpBuffer || NULL == outpFrame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(inBufferLength < CJT188_FRAME_LEN_MIN)
    {
        return E_CJT188_ERRO_FRAME_UNCOMP;
    }

    for(i = 0; i < 4; i++)
    {
        if(0xFE == buffer[i])
        {
            pos++;
            nNumber0xFE++;
        }
    }
    
    nCheckSumPosStart = pos;

    // 检查前导字符 0x68
    if(0x68 != buffer[pos])
    {
        return E_CJT188_ERRO_FRAME_0x68;
    }
    // 表类型
    pos++;
    //地址
    pos++;
    for(i = 0; i < CJT188_ADDR_LEN/2; i++)
    {
        addr_bcd[i] = buffer[pos++];
    }
    //地址
    cjt188_bcd2str(addr_bcd, addr_str, CJT188_ADDR_LEN/2);
    //控制码
    ucCtrlCode = buffer[pos++];
    //printf("\nCtrlCode = 0x%02X\n", ucCtrlCode);
    //转换控制码
    ret =  trans_cjt188ctrl_char2struct(ucCtrlCode, &(outpFrame->ctrl_s));
    if(E_CJT188_OK != ret)
    {
        return ret;
    }

    //数据域长度
    ucDataLen = buffer[pos++];
    nCheckSumPos = pos + ucDataLen;
    nEndPos = nCheckSumPos+1;

    for(i = 0; i < ucDataLen; i++)
    {
        aucDataTmp[i] = (buffer[pos++]); 
    }
    //查检checksum
    for(i = nCheckSumPosStart; i < nCheckSumPos; i++)
    {
        ucCheckSum +=  buffer[i];
    }


    if(ucCheckSum != buffer[nCheckSumPos])
    {
    
        return E_CJT188_ERRO_FRAME_CHECK_SUM;
    }

    //结束符
    if(0x16 != buffer[nEndPos])
    {
        return E_CJT188_ERRO_FRAME_END_0x16;
    }


    //地址
    for(i = 0; i < CJT188_ADDR_LEN; i++)
    {
        outpFrame->address[i] = addr_str[i];
        //printf("%d - %c \n",i, addr_str[i]);
    }

	//  原数据
	for(i = 0; i < ucDataLen; i++)
	{
		outpFrame->data_pack[i] = aucDataTmp[i];
	}
	outpFrame->data_len  = ucDataLen;
	
    // 正常的报文
    if(E_CJT188_CTRL_SR_OK == outpFrame->ctrl_s.reply)
    {    
		outpFrame->flag    = E_CJT188_UNPD_FLG_OK;
    }
    else
    {
        outpFrame->flag    = E_CJT188_UNPD_FLG_ERROR_OK;        
    }
    
    /* 封装输出最后信息 */
    outpFrame->lead_num  = nNumber0xFE;
    outpFrame->ctrl_c      = ucCtrlCode;
    outpFrame->ruler_id  = ulRulerID;
    
    outpFrame->frame_len = ucDataLen + 12;
    outpFrame->type      = stRulerInfor.type;
    outpFrame->format    = stRulerInfor.format;

    return E_CJT188_OK;
}

/*************************************************
Function:       get_cjt188_ruler_info
Description:    通过规约ID获得对应规约的详细信息:

                (1)规约的类型及额外数据
                (2)对应数据格式类型
                (3)数据域长度
                (4)数据域各数据单位
                (5)规约的可读写属性
                (6)该规约的数据项名称
                (7)实现对该条规约解析和封装函数指针

Author:         liming 

Calls:          
Called By:      
Input:          UINT32 rulerID 规约ID
                
Output:         S_CJT188_RULER_INFO *outRulerInfo
Return:         正确返回 0 其它为错误类型

Others:         重要函数，规约解析核心函数
  
*************************************************/
INT32 get_cjt188_ruler_info(UINT32 rulerID, S_CJT188_RULER_INFO *outRulerInfo)
{
    UINT8 ucDi3 = 0;
    UINT8 ucDi2 = 0;
    UINT8 ucDi1 = 0;
    UINT8 ucDi0 = 0;

    E_CJT188_RULER_TYPE     type   = E_CJT188_RULER_TYPE_UNKNOWN;   // 规约类型
    E_CJT188_RULER_RDWR     rdwr   = E_CJT188_RDWR_READ_ONLY;       // 规约数据的读写属性
    E_CJT188_RULER_FORMAT   format = E_CJT188_FMT_UNKOWN;           // 规约数据的格式
    F_CJT188_RULER_TRANS    func   = NULL;                       // 数据域转换函数指针
    S_CJT188_RULER_PARA     para   = {0};                        // 规约类型的额外数据
    INT32                len    = 0;                          // 数据域字节长度 
    char                 name[NAME_LEN]   = {0};              // 该条规约数据项名称
    char                 name_1[NAME_LEN-32] = {0};
    char strPayOff[32] = {0};

    if(NULL == outRulerInfo)
    {
        return E_CJT188_ERRO_NULL;
    }

    ucDi0 =  rulerID & 0xFF;
    ucDi1 = (rulerID >> 8) & 0xFF;
    
    //printf("D3 = 0x%02X \nD2 = 0x%02X \nD1 = 0x%02X \nD0 = 0x%02X\n", ucDi3, ucDi2,ucDi1,ucDi0);
    switch(rulerID)
    {
        case E_CJT188_RULER_TYPE_COMB_HAVE_TOTAL:
        {
            type = E_CJT188_RULER_TYPE_COMB_HAVE_TOTAL;
            snprintf(name_1, sizeof(name_1), "计量数据");
            para.payoff = E_CJT188_PAYOFF_NULL; /* 结算日 */
            para.rate    = E_CJT188_RATE_NULL;
            para.harm    = E_CJT188_HARM_NULL;
            para.last    = E_CJT188_LAST_NULL;
            rdwr         = E_CJT188_RDWR_READ_ONLY;
            format         = E_CJT188_FMT_XXXXXX_XX;
            len            = 4;
            func         = trans_cjt188_data_XXXXXX_XX;
            break;
        }
    }

    // 合成最后的名字
    snprintf(name, sizeof(name), "%s%s", strPayOff, name_1);

    // 结果数据输出 
    outRulerInfo->type = type;
    outRulerInfo->rdwr = rdwr;
    outRulerInfo->format = format;
    outRulerInfo->func = func;
    
    outRulerInfo->para.payoff = para.payoff;
    outRulerInfo->para.rate = para.rate;
    outRulerInfo->len = len;
    snprintf(outRulerInfo->name, sizeof(outRulerInfo->name), "%s", name);
    
    return E_CJT188_OK;
}


/*****************************************************************************
 函 数 名  : cjt188_bcd2str
 功能描述  : 将长度为len的BCD码转换为字符串
 输入参数  : const char* inBCD  
             char *outStr       
             INT32 len            
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月21日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
void cjt188_bcd2str(const char* inBCD, char *outStr, INT32 len)
{
    INT32 i = 0,j= 0;
    char c1 = 0,c0 = 0;

    if(NULL == inBCD || NULL == outStr || len < 1)
    {
        return;
    }
    
    for(i = len - 1,j = 0; i >= 0; i--)
    {
        c0 = inBCD[i] & 0xF;
        c1 = (inBCD[i] >> 4) & 0xF;
        if(c1 >= 0 && c1 <= 9)
        {
           outStr[j++] = c1 + '0';    
        }
        else
        {
           outStr[j++] = c1 + 'A';
        }
        
        if(c0 >= 0 && c0 <= 9)
        {
           outStr[j++] = c0 + '0';            
        }
        else
        {
           outStr[j++] = c0 + 'A';
        }    
    }
    
}

/* 函数实现 */

/*************************************************
Function:       str2bcd
Description:    将长度为len的字符串pstr将为BCD码输出pbcd
Calls:          
Called By:      
Input:          

Output:        

Return:        
Others:       pstr的长度是pbcd的二倍 

*************************************************/
void cjt188_str2bcd(const char *pstr, UINT8 *pbcd, INT32 len)
{
    UINT8 tmpValue;
    INT32 i;
    INT32 j;
    INT32 m;
    INT32 sLen;
    
    sLen = strlen(pstr);
    for(i = 0; i < sLen; i++)
    {
        if((pstr[i] < '0')
            ||((pstr[i] > '9') && (pstr[i] < 'A')) 
            ||((pstr[i] > 'F') && (pstr[i] < 'a')) 
            ||(pstr[i] > 'f'))
        {
            sLen=i;
            break;
        }
    }

    sLen = (sLen <= (len * 2) ) ?  sLen : sLen * 2;
    memset((void *)pbcd, 0x00, len);
    
    for(i=sLen-1, j=0, m=0; (i>=0)&&(m<len); i--, j++)
    {
        if((pstr[i] >= '0') && (pstr[i] <= '9'))
        {
            tmpValue=pstr[i] - '0';
        }
        else if((pstr[i] >= 'A') && (pstr[i] <= 'F'))
        {
            tmpValue=pstr[i] - 'A' + 0x0A;
        }
        else if((pstr[i] >= 'a') && (pstr[i] <= 'f'))
        {
            tmpValue=pstr[i] - 'a' + 0x0A;
        }
        else
        {
            tmpValue=0;
        }
        
        if((j%2)==0)
        {
            pbcd[m]=tmpValue;        
        }
        else
        {
            pbcd[m++]|=(tmpValue << 4);
        }
        
        if((tmpValue==0) && (pstr[i] != '0'))
        {
            break;
        }
    }
}

INT32 cjt188_pow_r(INT32 value,INT32 x)
{
    INT32 tmp = 1;
    while(x > 0){
        tmp *= value;
        x--;
    }
    return tmp;
}

/*************************************************
  Function:       BCD2Decimal
  Description:    将bcd码转换为十进制数
  Calls:          
  Called By:      
  Input:          UINT8* pBcd, UINT8 len
                
  Output:         
                    
  Return:         返回包的总长度值
  Others:         最大支持位数 20, 最大数为 18446744073709551616
*************************************************/
static double BCD2Decimal(UINT8* pBcd, INT32 len)
{
      INT32  i = 0;
    double dDeci = 0.0;
    
    for(i = len - 1; i >= 0; i--)
    {
        dDeci += (pBcd[i] >> 4) * 10;
        dDeci += (pBcd[i] & 0x0f);
        if(i != 0)
            dDeci *= 100;
    
    }    
    
    return dDeci;
}

/*****************************************************************************
 函 数 名  : cjt188_remove_dot
 功能描述  : 将inArray转出为长度为len的数组
 输入参数  : INT32 len         
             char*inArray    
             char *outArray  
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月21日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
INT32 cjt188_remove_dot(INT32 len, char*inArray, char *outArray)
{
    INT32 i = 0;
    INT32 j = 0;

    if(NULL == inArray || NULL == outArray)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    for(i = 0; j < len; i++)
    {
        if((inArray[i] < '0')
            ||((inArray[i] > '9') && (inArray[i] < 'A')) 
            ||((inArray[i] > 'F') && (inArray[i] < 'a')) 
            ||(inArray[i] > 'f'))
        {
            
            continue;
        }

        outArray[j++]= inArray[i];

    }

    outArray[j] = 0;

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : cjt188_add_dot
 功能描述  : 将inArray 中长度为len的内容加上一个小数点，位置是左数第dotpos
 输入参数  : INT32 len         
             char*inArray    
             char *outArray  
             INT32 dotpos      
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月21日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
INT32 cjt188_add_dot(INT32 len, char*inArray, char *outArray,  INT32 dotpos)
{
    INT32 i = 0;
    INT32 j = 0;
    INT32 p = 0;
    
    if(inArray == NULL || outArray == NULL)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    for(p = 0; i < len; p++)
    {
        if(p == dotpos)
        {
            outArray[j] = '.';
            j++;
        }
        else
        {
            outArray[j++] = inArray[i++];
        }
    }
    
    return E_CJT188_OK;
    
}
/*************************************************
  Function:       cjt188_bcd_to_double
  Description:    cjt188 2007将bcd码转换为十进制数浮点
  Calls:          
  Called By:      
  Input:          UINT8* pBcd, UINT8 len
                    UINT8 LeftDigit 小数点左移位是
                
  Output:         
                    
  Return:         返回包的总长度值
  Others:         最大支持位数 20, 最大数为 18446744073709551616
                  如果首位数为0x8X 则这个是负数
*************************************************/
double cjt188_bcd_to_double(UINT8* pBcd, INT32 len,INT32 LeftDigit)
{

    UINT8 ucPlus;
    INT32 flag = 1;
    double d = 0.0;
    ucPlus = pBcd[len-1];

    if(ucPlus & 0x80)
    {
        pBcd[len-1] &= 0x0F;
        flag = -1;
    }

    d = BCD2Decimal(pBcd, len);
    d = d/cjt188_pow_r(10, LeftDigit);
    d = d*flag;

    return d;

}

/*****************************************************************************
 函 数 名  : cjt188_str_to_double
 功能描述  : 将pstr转换为有效位数为digits，小数点位置在左数第rightDigitPos位的浮点数
 输入参数  : UINT8* pStr        
             INT32 digits         
             INT32 rightDigitPos  
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月22日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
double cjt188_str_to_double(char* pStr, INT32 digits, INT32 rightDigitPos)
{    
    double dRet = 0.0;
    char buf[20] = {0};

    if(NULL == pStr)
    {
        return 0.0;
    }
    
    cjt188_add_dot(digits, pStr, buf, rightDigitPos);

    dRet = atof(buf);
    return dRet;
}
    

/*****************************************************************************
 函 数 名  : trans_cjt188_data_XX_2
 功能描述  : XX_2
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_XX_2(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    return trans_cjt188_data_XXXX(flag, user, frame);
}
/*****************************************************************************
 函 数 名  : trans_cjt188_data_XX_3
 功能描述  : XX_3
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_XX_3(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    return trans_cjt188_data_XXXXXX(flag, user, frame);
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_XX_4
 功能描述  : XX_4
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_XX_4(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    return trans_cjt188_data_XXXXXXXX(flag, user, frame);
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_XX_6
 功能描述  : XX_6结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_XX_6(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[13] = {0};

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {
        memcpy((void*)acTmp, (void*)user, 12);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 13);
            printf("\t(XX_6) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 12);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 6);        
        memcpy((void*)user, (void*)acTmp, 12);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "XX_6\t=  %s\n", acTmp);
        }
       #endif

    }
    
    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_XX_8
 功能描述  : XX_8结构转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_XX_8(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[18] = {0};

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }    

    if(E_CJT188_TRANS_U2F == flag)
    {
        memcpy((void*)acTmp, (void*)user, 18);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 18);
            printf("\t(XX_8) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 16);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 8);        
        memcpy((void*)user, (void*)acTmp, 16);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "XX_8\t=  %s\n", acTmp);
        }
       #endif

    }
    
    return E_CJT188_OK;
}
/*****************************************************************************
 函 数 名  : trans_cjt188_data_XX_10
 功能描述  : XX_10结构
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_XX_10(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[21] = {0};

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {
        memcpy((void*)acTmp, (void*)user, 20);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 20);
            printf("\t(XX_10) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 20);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 10);        
        memcpy((void*)user, (void*)acTmp, 20);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "XX_10\t=  %s\n", acTmp);
        }
       #endif

    }
    
    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_XX_16
 功能描述  : XX_16结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_XX_16(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[33] = {0};

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {
        memcpy((void*)acTmp, (void*)user, 32);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 32);
            printf("\t(XX_16) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 32);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 16);        
        memcpy((void*)user, (void*)acTmp, 32);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "XX_16\t=  %s\n", acTmp);
        }
       #endif

    }
    
    return E_CJT188_OK;
}


eCJT188Err trans_cjt188_data_XXXX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[6] = {0};
    UINT16 usXXXX = 0;
    UINT16 * pUserData = NULL;
    
    if(NULL == user || NULL == frame )
    {
        return E_CJT188_ERRO_NULL;
    }
    printf("trans_cjt188_data_XXXX\n");

    if(E_CJT188_TRANS_U2F == flag)
    {        
        usXXXX = *(UINT16*)user;
        usXXXX = usXXXX & 0xFFFF;
        snprintf(acTmp, sizeof(acTmp), "%04d", usXXXX);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 5);
            printf("\t(XXXX) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 4);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 2);        
        pUserData = (UINT16*)user;
        *pUserData = atol(acTmp) & 0xFFFF;
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,"XXXX\t=  %d\n", *pUserData);
        }
       #endif
    }

    return E_CJT188_OK;
}

eCJT188Err trans_cjt188_data_XXXXXX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    UINT32 ulXXXXXX = 0;
    char acTmp[9] = {0};
    UINT32 * pulUserData = NULL;
    
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
#endif    
    if(E_CJT188_TRANS_U2F == flag)
    {
        
        ulXXXXXX = *(UINT32*)user;
        ulXXXXXX = ulXXXXXX & 0xFFFFFF;
        
        snprintf(acTmp, sizeof(acTmp), "%06d", ulXXXXXX);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 7);
            printf("\t(XXXXXX) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 6);
    }
    else // frame to user
    {        
        cjt188_bcd2str(frame, acTmp, 6);        
        pulUserData = (UINT32*)user;
        * pulUserData = atol(acTmp);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen = sprintf(g_out_data_07,"XXXXXX\t=  %s\n", acTmp);
            outLen = sprintf(g_out_data_07 + outLen," XXXXXX\t=  %06d\n", *pulUserData);
        }
       #endif

    }

    return E_CJT188_OK;

}

// X.XXX
eCJT188Err trans_cjt188_data_X_XXX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    float fltX_XXX = 0.0;
    char acTmp[6] = {0};
    char strOut[6] = {0};
    char acX_XXX[6] = {0};
    float * pfUserData = NULL;
    
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
#endif    

    if(E_CJT188_TRANS_U2F == flag)
    {        
        fltX_XXX = *(float*)user;
        sprintf(acTmp, "%1.3f", fltX_XXX);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 6);
            printf("\t(X.XXX) << ");
            scanf("%s",(CHAR*)&acTmp);
        }
        #endif
        
        cjt188_remove_dot(4,acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 4);
    }
    else // frame to user
    {

        cjt188_bcd2str(frame, acTmp, 2);
        cjt188_add_dot(4, acTmp, acX_XXX, 1);    
        pfUserData = (float*)user;
        * pfUserData = atof(acX_XXX);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen = sprintf(g_out_data_07,"XXXX  =  %s\n", acTmp);
            outLen = sprintf(g_out_data_07 + outLen," X.XXX =  %1.3f\n", *pfUserData);
        }
        #endif
    }

    return E_CJT188_OK;
}

// XX.XXXX
eCJT188Err trans_cjt188_data_XX_XXXX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    float fltXX_XXXX = 0.0;
    char acTmp[8] = {0};
    char strOut[8] = {0};    
    char acXX_XXXX[8] = {0};
    float * pfUserData = NULL;
    
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
#endif    

    if(E_CJT188_TRANS_U2F == flag)
    {
        
        fltXX_XXXX = *(float*)user;
        sprintf(acTmp, "%2.4f", fltXX_XXXX);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 8);
            printf("\t(XX.XXXX) << ");
            scanf("%s",(CHAR*)&acTmp);
        }
        #endif
        
        cjt188_remove_dot(6,acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 6);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 3);
        cjt188_add_dot(6, acTmp, acXX_XXXX, 2);    
        pfUserData = (float*)user;
        * pfUserData = atof(acXX_XXXX);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen = sprintf(g_out_data_07,"XXXXXX  =  %s\n", acTmp);
            outLen = sprintf(g_out_data_07 + outLen," XX.XXXX =  %2.4f\n", *pfUserData);
        }
        #endif
    }

    return E_CJT188_OK;

}


// XXXX.XXXX
eCJT188Err trans_cjt188_data_XXXX_XXXX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    float fltXXXX_XXXX = 0.0;
    char acTmp[9] = {0};
    char strOut[9] = {0};    
    char acXXXX_XXXX[9] = {0};
    float * pfUserData = NULL;
    
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
#endif    

    if(E_CJT188_TRANS_U2F == flag)
    {
        
        fltXXXX_XXXX = *(float*)user;
        sprintf(acTmp, "%4.4f", fltXXXX_XXXX);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 8);
            printf("\t(XXXX.XXXX) << ");
            scanf("%s",(CHAR*)&acTmp);
        }
        #endif
        
        cjt188_remove_dot(8,acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 8);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 4);
        cjt188_add_dot(8, acTmp, acXXXX_XXXX, 4);    
        pfUserData = (float*)user;
        * pfUserData = atof(acXXXX_XXXX);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen = sprintf(g_out_data_07,"XXXXXXXX  =  %s\n", acTmp);
            outLen = sprintf(g_out_data_07 + outLen," XXXX.XXXX =  %4.4f\n", *pfUserData);
        }
        #endif
    }

    return E_CJT188_OK;

}


eCJT188Err trans_cjt188_data_XX_XXXX_8(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_XX_XXXX_8 * pDataUser = NULL;
    char acTmp[60] = {0};
    char strOut[48] = {0};
    INT32 i = 0;
    
    #ifdef CJT188_DEBUG_ON
    S_CJT188_XX_XXXX_8 sXX_XXXX = {0};
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_XX_XXXX_8*)user;
 
    if(E_CJT188_TRANS_U2F == flag)
    {
          #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 60);
        
             sXX_XXXX.fXX_XXXXX[0] = 12.3456;
             sXX_XXXX.fXX_XXXXX[1] = 12.3456;
             sXX_XXXX.fXX_XXXXX[2] = 12.3456;
             sXX_XXXX.fXX_XXXXX[3] = 12.3456;
             sXX_XXXX.fXX_XXXXX[4] = 12.3456; 
             sXX_XXXX.fXX_XXXXX[5] = 12.3456;
             sXX_XXXX.fXX_XXXXX[6] = 12.3456;
             sXX_XXXX.fXX_XXXXX[7] = 12.3456;

            pDataUser = (S_CJT188_XX_XXXX_8 *)&sXX_XXXX;
        }
        #endif
        
        snprintf(acTmp, sizeof(acTmp),
                 "%2.4f%2.4f%2.4f%2.4f%2.4f%2.4f%2.4f%2.4f", 
                 pDataUser->fXX_XXXXX[0],
                 pDataUser->fXX_XXXXX[1],
                 pDataUser->fXX_XXXXX[2],
                 pDataUser->fXX_XXXXX[3],
                 pDataUser->fXX_XXXXX[4],
                 pDataUser->fXX_XXXXX[5],
                 pDataUser->fXX_XXXXX[6],
                 pDataUser->fXX_XXXXX[7]);
        
        cjt188_remove_dot(48,acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 48);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 24);
    
        pDataUser->fXX_XXXXX[0] = cjt188_str_to_double(&acTmp[i],    6, 2);
        pDataUser->fXX_XXXXX[1] = cjt188_str_to_double(&acTmp[i+=6], 6, 2);
        pDataUser->fXX_XXXXX[2] = cjt188_str_to_double(&acTmp[i+=6], 6, 2);
        pDataUser->fXX_XXXXX[3] = cjt188_str_to_double(&acTmp[i+=6], 6, 2);
        pDataUser->fXX_XXXXX[4] = cjt188_str_to_double(&acTmp[i+=6], 6, 2);
        pDataUser->fXX_XXXXX[5] = cjt188_str_to_double(&acTmp[i+=6], 6, 2);
        pDataUser->fXX_XXXXX[6] = cjt188_str_to_double(&acTmp[i+=6], 6, 2);
        pDataUser->fXX_XXXXX[7] = cjt188_str_to_double(&acTmp[i+=6], 6, 2);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            snprintf(g_out_data_07, sizeof(g_out_data_07),                 
                    "fXX_XXXXX[8] = \n%2.4f\n%2.4f\n%2.4f\n%2.4f\n%2.4f\n%2.4f\n%2.4f\n%2.4f\n", 
                     pDataUser->fXX_XXXXX[0],
                     pDataUser->fXX_XXXXX[1],
                     pDataUser->fXX_XXXXX[2],
                     pDataUser->fXX_XXXXX[3],
                     pDataUser->fXX_XXXXX[4],
                     pDataUser->fXX_XXXXX[5],
                     pDataUser->fXX_XXXXX[6],
                     pDataUser->fXX_XXXXX[7]);
        }
        #endif
    }

    return E_CJT188_OK;

}

//XXX.XXX
eCJT188Err trans_cjt188_data_XXX_XXX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    float fltXXX_XXX = 0.0;
    char acTmp[8] = {0};
    char strOut[8] = {0};
    char acXXX_XXX[8] = {0};    
    float * pfUserData  = NULL;
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
#endif

    if(E_CJT188_TRANS_U2F == flag)
    {
        
        fltXXX_XXX = *(float*)user;
        sprintf(acTmp, "%6.3f", fltXXX_XXX);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 8);
            printf("\t(XXX.XXX) << ");
            scanf("%s",(CHAR*)&acTmp);
        }
        #endif
        
        cjt188_remove_dot(6,acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 6);
    }
    else // frame to user
    {        
        cjt188_bcd2str(frame, acTmp, 3);
        cjt188_add_dot(6, acTmp, acXXX_XXX, 3);    
        pfUserData = (float*)user;
        * pfUserData = atof(acXXX_XXX);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen = sprintf(g_out_data_07,"XXXXXX\t=  %s\n", acTmp);
            outLen = sprintf(g_out_data_07 + outLen," XXX.XXX\t=  %6.3f\n", *pfUserData);
        }
        #endif
    }

    return E_CJT188_OK;

}

eCJT188Err trans_cjt188_data_YYMMDDhhmmss_XXX_XXX_YYMMDDhhmmss(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_YYMMDDhhmmss_XX_XXXX_YYMMDDhhmmss *pDataUser = (S_CJT188_YYMMDDhhmmss_XX_XXXX_YYMMDDhhmmss *)user;
    char str[300] = {0};
    char strOut[31] = {0};
    INT32 i = 0;
    
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
#endif

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
        
    if(E_CJT188_TRANS_U2F == flag)
    {

        //测试数据
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            pDataUser->sBgnTime.YY = 11;
            pDataUser->sBgnTime.MM = 11;
            pDataUser->sBgnTime.DD = 11;
            pDataUser->sBgnTime.hh = 11;
            pDataUser->sBgnTime.mm = 11;
            pDataUser->sBgnTime.ss = 11;
            //sEndTime
            pDataUser->sEndTime.YY = 11;
            pDataUser->sEndTime.MM = 11;
            pDataUser->sEndTime.DD = 11;
            pDataUser->sEndTime.hh = 11;
            pDataUser->sEndTime.mm = 11;
            pDataUser->sEndTime.ss = 11;
            //fXXX_XXX
            pDataUser->fXXX_XXX = 111.111;
        }
        #endif
        
        snprintf(str, sizeof(str), 
                "%02d%02d%02d%02d%02d%02d"        //sBgnTime
                "%02d%02d%02d%02d%02d%02d"        //sEndTime
                "%06.3f",        //fXXX_XXX
                //sBgnTime
                pDataUser->sBgnTime.YY,
                pDataUser->sBgnTime.MM,
                pDataUser->sBgnTime.DD,
                pDataUser->sBgnTime.hh,
                pDataUser->sBgnTime.mm,
                pDataUser->sBgnTime.ss,
                //sEndTime
                pDataUser->sEndTime.YY,
                pDataUser->sEndTime.MM,
                pDataUser->sEndTime.DD,
                pDataUser->sEndTime.hh,
                pDataUser->sEndTime.mm,
                pDataUser->sEndTime.ss,
                //fXXX_XXX
                pDataUser->fXXX_XXX);

        cjt188_remove_dot(30,str, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 30);
        
    }
    else// frame to user interface
    {
        
        cjt188_bcd2str(frame, str, 15);
        pDataUser->sBgnTime.YY = cjt188_str_to_num(&str[i],    2);
        pDataUser->sBgnTime.MM = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sBgnTime.DD = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sBgnTime.hh = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sBgnTime.mm = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sBgnTime.ss = cjt188_str_to_num(&str[i+=2], 2);
        //sEndTime
        pDataUser->sEndTime.YY = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.MM = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.DD = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.hh = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.mm = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.ss = cjt188_str_to_num(&str[i+=2], 2);
        //fXXX_XXX
        pDataUser->fXXX_XXX = cjt188_str_to_double(&str[i+=2], 6, 2);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
        
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            snprintf(g_out_data_07, sizeof(g_out_data_07),
                "sBgnTime = %02d %02d %02d %02d %02d %02d\n"        //sBgnTime
                "sEndTime = %02d %02d %02d %02d %02d %02d\n"        //sEndTime
                "fXXX_XXX  = %06.3f\n",        //sDemand
                //sBgnTime
                pDataUser->sBgnTime.YY,
                pDataUser->sBgnTime.MM,
                pDataUser->sBgnTime.DD,
                pDataUser->sBgnTime.hh,
                pDataUser->sBgnTime.mm,
                pDataUser->sBgnTime.ss,
                //sEndTime
                pDataUser->sEndTime.YY,
                pDataUser->sEndTime.MM,
                pDataUser->sEndTime.DD,
                pDataUser->sEndTime.hh,
                pDataUser->sEndTime.mm,
                pDataUser->sEndTime.ss,
                //sDemand
                pDataUser->fXXX_XXX);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_XXXXXX_2
 功能描述  : XXXXXX_2结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_XXXXXX_2(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_XXXXXX_2 * pUserData = (S_CJT188_XXXXXX_2*)user;
    char acTmp[17] = {0};
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
 #endif
 
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        snprintf(acTmp, sizeof(acTmp), "%06ld%06ld", 
                        (long int)((pUserData->ulTimes)   & 0xFFFFFF),
                        (long int)((pUserData->ulMinutes) & 0xFFFFFF));

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, (char)0x00, 12);
            printf("\t(XXXXXX_2) << ");
            scanf("%s", (char*)&acTmp);
            
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 12);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 6);        
        pUserData->ulTimes   = cjt188_str_to_num(&acTmp[0],  6);
        pUserData->ulMinutes = cjt188_str_to_num(&acTmp[6],  6);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {            
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen += sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", pUserData->ulTimes);
            outLen += sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", pUserData->ulMinutes);    
        }
       #endif

    }

    return E_CJT188_OK;

}



eCJT188Err trans_cjt188_data_XXXXXX_6(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{    
    S_CJT188_XXXXXX_6 *pXXXXXX_6 = NULL;
    char acTmp[49] = {0};
    S_CJT188_XXXXXX_6 * pUserData = NULL;
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
#endif
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {
    
        pXXXXXX_6 = (S_CJT188_XXXXXX_6*)user;
    
        snprintf(acTmp, sizeof(acTmp), "%06ld%06ld%06ld%06ld%06ld%06ld", 
                        (long int)((pXXXXXX_6->a_times)   & 0xFFFFFF),
                        (long int)((pXXXXXX_6->a_seconds) & 0xFFFFFF),
                        (long int)((pXXXXXX_6->b_times)   & 0xFFFFFF),
                        (long int)((pXXXXXX_6->b_seconds) & 0xFFFFFF),
                        (long int)((pXXXXXX_6->c_times)   & 0xFFFFFF),
                        (long int)((pXXXXXX_6->c_seconds) & 0xFFFFFF));

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, (char)0x00, 37);
            printf("\t(XXXXXX_6) << ");
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 18);
    }
    else // frame to user
    {    
        cjt188_bcd2str(frame, acTmp, 18);        
        pUserData = (S_CJT188_XXXXXX_6*)user;
        pUserData->a_times   = cjt188_str_to_num(&acTmp[0],  6);
        pUserData->a_seconds = cjt188_str_to_num(&acTmp[6],  6);
        pUserData->b_times     = cjt188_str_to_num(&acTmp[12], 6);
        pUserData->b_seconds = cjt188_str_to_num(&acTmp[18], 6);
        pUserData->c_times   = cjt188_str_to_num(&acTmp[24], 6);
        pUserData->c_seconds = cjt188_str_to_num(&acTmp[30], 6);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {            
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen += sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", pUserData->a_times);
            outLen += sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", pUserData->a_seconds);
            outLen += sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", pUserData->b_times);
            outLen += sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", pUserData->b_seconds);
            outLen += sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", pUserData->c_times);
            outLen += sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", pUserData->c_seconds);
        }
       #endif

    }

    return E_CJT188_OK;

}

eCJT188Err trans_cjt188_data_XXXXXXXX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    UINT32 ulXXXXXXXX = 0.0;
    char acTmp[9] = {0};
    UINT32 * pulUserData = NULL;
    
#ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
#endif 

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }


    if(E_CJT188_TRANS_U2F == flag)
    {        
        ulXXXXXXXX = *(UINT32*)user;
        sprintf(acTmp, "%08d", ulXXXXXXXX);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 9);
            printf("\t(XXXXXXXX) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 8);
    }
    else // frame to user
    {
        
        cjt188_bcd2str(frame, acTmp, 4);        
        pulUserData = (UINT32*)user;
        * pulUserData = atol(acTmp);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {            
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen = sprintf(g_out_data_07,"XXXXXXXX\t=  %s\n", acTmp);
            outLen = sprintf(g_out_data_07 + outLen," XXXXXXXX\t=  %06d\n", *pulUserData);
        }
       #endif

    }

    return E_CJT188_OK;

}

// XX.XX
eCJT188Err trans_cjt188_data_XX_XX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    float fltXX_XX = 0.0;
    char acTmp[6] = {0};
    char strOut[6] = {0};
    char acXX_XX[6] = {0};
    float * pfUserData  = NULL;
    
    #ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }


    if(E_CJT188_TRANS_U2F == flag)
    {
        
        fltXX_XX = *(float*)user;
    
        sprintf(acTmp, "%2.2f", fltXX_XX);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 6);
            printf("\t(XX.XX) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
    
        cjt188_remove_dot(4,acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 4);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 2);        
        cjt188_add_dot(4, acTmp, acXX_XX, 2);    
        pfUserData = (float*)user;
        * pfUserData = atof(acXX_XX);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {            
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen = sprintf(g_out_data_07,"XXXX\t=  %s\n", acTmp);
            outLen = sprintf(g_out_data_07 + outLen," XXX.X\t=  %2.2f\n", *pfUserData);
        }
       #endif

    }

    return E_CJT188_OK;

}

eCJT188Err trans_cjt188_data_XXX_X(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[6] = {0};
    char strOut[6] = {0};
    char acX_XXX[6] = {0};
    float fltXXX_X = 0.0;
    float * pfUserData = NULL;

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {
        fltXXX_X = *(float*)user;
        sprintf(acTmp, "%3.1f", fltXXX_X);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 6);
            printf("\t(XXX.X) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
    
        cjt188_remove_dot(4,acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 4);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 2);        
        cjt188_add_dot(4, acTmp, acX_XXX, 3);    
        pfUserData = (float*)user;
        *pfUserData = atof(acX_XXX);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                "XXXX\t=  %s\n"
                "XXX.X\t=  %4.1f\n",
                acTmp,
                *pfUserData);
        }
       #endif

    }
    return E_CJT188_OK;

}

eCJT188Err trans_cjt188_data_XXXXXX_XX(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char str[9] = {0};
    double dd;
    
    
#ifdef CJT188_DEBUG_ON
    char c;
    
    INT32 outLen = 0;
    char strOut[8] = {0};
    INT32 i = 0;
#endif    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            //float fInput = 0.0;
            
            printf("\t(XXXXXX.XX) << ");
            scanf("%s", (char*)&str);
            cjt188_remove_dot(8,str, strOut);

            cjt188_str2bcd(strOut, (UINT8*)frame, 8);
            
            for(i = 0; i < 4; i++)
            {    
                c = frame[i];
                //printf("%d%d",  (c >> 4)&0xF , c & 0xF);
            }
            //printf("\n");
            dd = BCD2Decimal((UINT8*)frame,4);

            printf("\tdouble = %6.2f\n\n", dd/100);
        }

        #endif
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, str,4);
        dd = cjt188_bcd_to_double((UINT8*)frame, 4, 2);
        *(float*)user = (float)dd;
       // printf("dd = %6.2f\n", dd);
        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen = sprintf(g_out_data_07,"XXXXXXXX\t=  %s\n", str);
            outLen = sprintf(g_out_data_07 + outLen," XXXXXX.XX\t=  %6.2f\n", dd);
        }
        #endif
    }
    return E_CJT188_OK;
}



eCJT188Err trans_cjt188_data_YYMMDDhhmmss_2_XX_XXXX_YYMMDDhhmm(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_YYMMDDhhmmss_2_XX_XXXX_YYMMDDhhmm *pDataUser = NULL;
    char str[300] = {0};
    char strOut[41] = {0};
    INT32 i = 0;
    
    #ifdef CJT188_DEBUG_ON
    INT32 outLen = 0;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_YYMMDDhhmmss_2_XX_XXXX_YYMMDDhhmm *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        #ifdef CJT188_DEBUG_ON
        //测试数据
        if(CJT188_ON == g_need_pack_07)
        {
            pDataUser->sBgnTime.YY = 11;
            pDataUser->sBgnTime.MM = 11;
            pDataUser->sBgnTime.DD = 11;
            pDataUser->sBgnTime.hh = 11;
            pDataUser->sBgnTime.mm = 11;
            pDataUser->sBgnTime.ss = 11;
            //sEndTime
            pDataUser->sEndTime.YY = 11;
            pDataUser->sEndTime.MM = 11;
            pDataUser->sEndTime.DD = 11;
            pDataUser->sEndTime.hh = 11;
            pDataUser->sEndTime.mm = 11;
            pDataUser->sEndTime.ss = 11;
            //sDemand
            pDataUser->sDemand.fXX_XXXX = 11.1111;
            pDataUser->sDemand.YY = 11;
            pDataUser->sDemand.MM = 11;
            pDataUser->sDemand.DD = 11;
            pDataUser->sDemand.hh = 11;
            pDataUser->sDemand.mm = 11;
        }
        #endif
        
        sprintf(str, 
                "%02d%02d%02d%02d%02d%02d"        //sBgnTime
                "%02d%02d%02d%02d%02d%02d"        //sEndTime
                "%06.4f%02d%02d%02d%02d%02d",        //sDemand
                //sBgnTime
                pDataUser->sBgnTime.YY,
                pDataUser->sBgnTime.MM,
                pDataUser->sBgnTime.DD,
                pDataUser->sBgnTime.hh,
                pDataUser->sBgnTime.mm,
                pDataUser->sBgnTime.ss,
                //sEndTime
                pDataUser->sEndTime.YY,
                pDataUser->sEndTime.MM,
                pDataUser->sEndTime.DD,
                pDataUser->sEndTime.hh,
                pDataUser->sEndTime.mm,
                pDataUser->sEndTime.ss,
                //sDemand
                pDataUser->sDemand.fXX_XXXX,
                pDataUser->sDemand.YY,
                pDataUser->sDemand.MM,
                pDataUser->sDemand.DD,
                pDataUser->sDemand.hh,
                pDataUser->sDemand.mm);

        cjt188_remove_dot(40,str, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 40);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, str, 20);
        pDataUser->sBgnTime.YY = cjt188_str_to_num(&str[i],    2);
        pDataUser->sBgnTime.MM = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sBgnTime.DD = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sBgnTime.hh = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sBgnTime.mm = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sBgnTime.ss = cjt188_str_to_num(&str[i+=2], 2);
        //sEndTime
        pDataUser->sEndTime.YY = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.MM = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.DD = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.hh = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.mm = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sEndTime.ss = cjt188_str_to_num(&str[i+=2], 2);
        //sDemand
        pDataUser->sDemand.fXX_XXXX = cjt188_str_to_double(&str[i+=2], 6, 2);
        pDataUser->sDemand.YY = cjt188_str_to_num(&str[i+=6], 2);
        pDataUser->sDemand.MM = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sDemand.DD = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sDemand.hh = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sDemand.mm = cjt188_str_to_num(&str[i+=2], 2);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                "sBgnTime = %02d %02d %02d %02d %02d %02d\n"        //sBgnTime
                "sEndTime = %02d %02d %02d %02d %02d %02d\n"        //sEndTime
                "sDemand  = %06.4f %02d %02d %02d %02d %02d\n",        //sDemand
                //sBgnTime
                pDataUser->sBgnTime.YY,
                pDataUser->sBgnTime.MM,
                pDataUser->sBgnTime.DD,
                pDataUser->sBgnTime.hh,
                pDataUser->sBgnTime.mm,
                pDataUser->sBgnTime.ss,
                //sEndTime
                pDataUser->sEndTime.YY,
                pDataUser->sEndTime.MM,
                pDataUser->sEndTime.DD,
                pDataUser->sEndTime.hh,
                pDataUser->sEndTime.mm,
                pDataUser->sEndTime.ss,
                //sDemand
                pDataUser->sDemand.fXX_XXXX,
                pDataUser->sDemand.YY,
                pDataUser->sDemand.MM,
                pDataUser->sDemand.DD,
                pDataUser->sDemand.hh,
                pDataUser->sDemand.mm);
        }
        #endif
    }

    return E_CJT188_OK;
}

//YYMMDDhhmmss_YYMMDDhhmmss
eCJT188Err trans_cjt188_data_YYMMDDhhmmss_2(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_YYMMDDhhmmss_2 *pYYMMDDhhmmss_2 = NULL;
    char acTmp[37] = {0};
    INT32 i = 0;
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    pYYMMDDhhmmss_2 = (S_CJT188_YYMMDDhhmmss_2*)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        snprintf(acTmp, sizeof(acTmp),
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d%02d%02d", 
                pYYMMDDhhmmss_2->sBegin.YY,
                pYYMMDDhhmmss_2->sBegin.MM,
                pYYMMDDhhmmss_2->sBegin.DD,
                pYYMMDDhhmmss_2->sBegin.hh,
                pYYMMDDhhmmss_2->sBegin.mm,
                pYYMMDDhhmmss_2->sBegin.ss,
                pYYMMDDhhmmss_2->sEnd.YY,
                pYYMMDDhhmmss_2->sEnd.MM,
                pYYMMDDhhmmss_2->sEnd.DD,
                pYYMMDDhhmmss_2->sEnd.hh,
                pYYMMDDhhmmss_2->sEnd.mm,
                pYYMMDDhhmmss_2->sEnd.ss);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 24);
            printf("\t(YYMMDDhhmmss_YYMMDDhhmmss) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 24);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 12);        
        
        pYYMMDDhhmmss_2->sBegin.YY = cjt188_str_to_num(&acTmp[i], 2);
        pYYMMDDhhmmss_2->sBegin.MM = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sBegin.DD = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sBegin.hh = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sBegin.mm = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sBegin.ss = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sEnd.YY = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sEnd.MM = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sEnd.DD = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sEnd.hh = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sEnd.mm = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss_2->sEnd.ss = cjt188_str_to_num(&acTmp[i+=2], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                    "YYMMDDhhmmss_1 = %02d%02d%02d%02d%02d%02d"
                    "YYMMDDhhmmss_2 = %02d%02d%02d%02d%02d%02d", 
                    pYYMMDDhhmmss_2->sBegin.YY,
                    pYYMMDDhhmmss_2->sBegin.MM,
                    pYYMMDDhhmmss_2->sBegin.DD,
                    pYYMMDDhhmmss_2->sBegin.hh,
                    pYYMMDDhhmmss_2->sBegin.mm,
                    pYYMMDDhhmmss_2->sBegin.ss,
                    pYYMMDDhhmmss_2->sEnd.YY,
                    pYYMMDDhhmmss_2->sEnd.MM,
                    pYYMMDDhhmmss_2->sEnd.DD,
                    pYYMMDDhhmmss_2->sEnd.hh,
                    pYYMMDDhhmmss_2->sEnd.mm,
                    pYYMMDDhhmmss_2->sEnd.ss);
        }
       #endif
    }

    return E_CJT188_OK;
}
/*****************************************************************************
 函 数 名  : trans_cjt188_data_YYMMDDhhmm
 功能描述  : YYMMDDhhmm
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_YYMMDDhhmm(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_YYMMDDhhmm *pYYMMDDhhmmNN = NULL;
    char acTmp[16] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    pYYMMDDhhmmNN = (S_CJT188_YYMMDDhhmm*)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        snprintf(acTmp, sizeof(acTmp),
                "%02d%02d%02d%02d%02d", 
                pYYMMDDhhmmNN->YY,
                pYYMMDDhhmmNN->MM,
                pYYMMDDhhmmNN->DD,
                pYYMMDDhhmmNN->hh,
                pYYMMDDhhmmNN->mm);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 12);
            printf("\t(YYMMDDhhmm) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 10);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 5);        
        
        pYYMMDDhhmmNN->YY = cjt188_str_to_num(&acTmp[i], 2);
        pYYMMDDhhmmNN->MM = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmNN->DD = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmNN->hh = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmNN->mm = cjt188_str_to_num(&acTmp[i+=2], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                    "YY = %02d\nMM = %02d\nDD = %02d\nhh = %02d\nmm = %02d\n", 
                    pYYMMDDhhmmNN->YY,
                    pYYMMDDhhmmNN->MM,
                    pYYMMDDhhmmNN->DD,
                    pYYMMDDhhmmNN->hh,
                    pYYMMDDhhmmNN->mm);
        }
       #endif
    }

    return E_CJT188_OK;
}

eCJT188Err trans_cjt188_data_YYMMDDhhmmNN(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_YYMMDDhhmmNN *pYYMMDDhhmmNN = NULL;
    char acTmp[19] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    pYYMMDDhhmmNN = (S_CJT188_YYMMDDhhmmNN*)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        snprintf(acTmp, sizeof(acTmp),
                "%02d%02d%02d%02d%02d%02d", 
                pYYMMDDhhmmNN->YY,
                pYYMMDDhhmmNN->MM,
                pYYMMDDhhmmNN->DD,
                pYYMMDDhhmmNN->hh,
                pYYMMDDhhmmNN->mm,
                pYYMMDDhhmmNN->NN);
#ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 12);
            printf("\t(YYMMDDhhmmNN) << ");
            scanf("%s",(char*)&acTmp);
        }
#endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 12);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 6);        
        
        pYYMMDDhhmmNN->YY = cjt188_str_to_num(&acTmp[i], 2);
        pYYMMDDhhmmNN->MM = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmNN->DD = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmNN->hh = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmNN->mm = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmNN->NN = cjt188_str_to_num(&acTmp[i+=2], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                    "YY = %02d\nMM = %02d\nDD = %02d\nhh = %02d\nmm = %02d\nNN = %02d\n", 
                    pYYMMDDhhmmNN->YY,
                    pYYMMDDhhmmNN->MM,
                    pYYMMDDhhmmNN->DD,
                    pYYMMDDhhmmNN->hh,
                    pYYMMDDhhmmNN->mm,
                    pYYMMDDhhmmNN->NN);
        }
     #endif
    }

    return E_CJT188_OK;
}


eCJT188Err trans_cjt188_data_YYMMDDhhmmss(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{

    S_CJT188_YYMMDDhhmmss *pYYMMDDhhmmss = NULL;
    char acTmp[19] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    pYYMMDDhhmmss = (S_CJT188_YYMMDDhhmmss*)user;

    if(E_CJT188_TRANS_U2F == flag)
    {
        snprintf(acTmp, sizeof(acTmp),
                "%02d%02d%02d%02d%02d%02d", 
                pYYMMDDhhmmss->YY,
                pYYMMDDhhmmss->MM,
                pYYMMDDhhmmss->DD,
                pYYMMDDhhmmss->hh,
                pYYMMDDhhmmss->mm,
                pYYMMDDhhmmss->ss);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 12);
            printf("\t(YYMMDDhhmmss) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 12);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 6);        
    
        pYYMMDDhhmmss->YY = cjt188_str_to_num(&acTmp[i], 2);
        pYYMMDDhhmmss->MM = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss->DD = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss->hh = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss->mm = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDhhmmss->ss = cjt188_str_to_num(&acTmp[i+=2], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                    "YY = %02d\nMM = %02d\nDD = %02d\nhh = %02d\nmm = %02d\nss = %02d\n", 
                    pYYMMDDhhmmss->YY,
                    pYYMMDDhhmmss->MM,
                    pYYMMDDhhmmss->DD,
                    pYYMMDDhhmmss->hh,
                    pYYMMDDhhmmss->mm,
                    pYYMMDDhhmmss->ss);
        }
       #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_NN
 功能描述  : 数据结构NN转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_NN(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[4] = {0};    
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    printf("trans_cjt188_data_NN\n");
    
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        snprintf(acTmp, sizeof(acTmp), "%02d", *user);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 3);
            printf("\t(NN) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 2);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 1);        
        *user = cjt188_str_to_num(&acTmp[0], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,"NN = %02d\n", *user);
        }
       #endif
    }

    return E_CJT188_OK;
}


eCJT188Err trans_cjt188_data_NNNN(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    return trans_cjt188_data_XXXX(flag, user, frame);
}


eCJT188Err trans_cjt188_data_NN_4(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    return trans_cjt188_data_XXXXXXXX(flag, user, frame);
}

eCJT188Err trans_cjt188_data_NN_6(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    return trans_cjt188_data_XX_6(flag, user, frame);
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_NN_32
 功能描述  : NN_32转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月30日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_NN_32(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[65] = {0};
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {
        memcpy((void*)acTmp, (void*)user, 64);
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 64);
            printf("\t(NN_32) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 64);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 32);        
        memcpy((void*)user, (void*)acTmp, 64);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "NN_32\t=  %s\n", acTmp);
        }
       #endif

    }
    
    return E_CJT188_OK;
}

// N.NNN
eCJT188Err trans_cjt188_data_N_NNN(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[6]   = {0};
    char acX_XXX[6] = {0};
    float fltX_XXX = 0.0;
    char strOut[6] = {0};
    float * pfUserData = NULL;

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        
        fltX_XXX = *(float*)user;
        sprintf(acTmp, "%4.3f", fltX_XXX);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 6);
            printf("\t(NN.NNN) << ");
            scanf("%s",(CHAR*)&acTmp);
        }
        #endif
        
        cjt188_remove_dot(4, acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 4);
    }
    else // frame to user
    {
        
        cjt188_bcd2str(frame, acTmp, 2);
        cjt188_add_dot(4, acTmp, acX_XXX, 1);    
        pfUserData = (float*)user;
        * pfUserData = atof(acX_XXX);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,"NNNN  =  %s\n N.NNN =  %4.3f\n", acTmp,*pfUserData);
        }
        #endif
    }

    return E_CJT188_OK;

}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_NN_NNNN
 功能描述  : NN.NNNN结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月30日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_NN_NNNN(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[8] = {0};
    char strOut[6] = {0};
    float* pfNN_NNNN = (float*)user;
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        sprintf(acTmp, "%6.4f", *pfNN_NNNN);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 8);
            printf("\t(NN.NNNN) << ");
            scanf("%s",(CHAR*)&acTmp);
        }
        #endif
        
        cjt188_remove_dot(6, acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 6);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 3);
        *pfNN_NNNN = cjt188_str_to_double(&acTmp[0], 6, 2);
        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,"NN.NNNN  =  %6.4f\n", *pfNN_NNNN);
        }
        #endif
    }

    return E_CJT188_OK;
}


/*****************************************************************************
 函 数 名  : trans_cjt188_data_NNN_N
 功能描述  : NNN.N结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月30日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_NNN_N(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[5] = {0};
    char strOut[4] = {0};
    float* pfNNN_N = (float*)user;

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {        
        sprintf(acTmp, "%4.1f", *pfNNN_N);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 5);
            printf("\t(NNN.N) << ");
            scanf("%s",(CHAR*)&acTmp);
        }
        #endif
        
        cjt188_remove_dot(4, acTmp, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 4);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 2);
        printf("acTmp = %s\n", acTmp);
        *pfNNN_N = (float)cjt188_str_to_double((char*)&acTmp[0], 4, 3);

        
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,"NNN.N  =  %4.1f\n", *pfNNN_N);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_MMDDNN_14
 功能描述  : MMDDNN_14结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月30日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_MMDDNN_14(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[84] = {0};
    UINT8 *pData = (UINT8*)user;
    UINT8 *pArray = (UINT8*)acTmp;
    INT32 j = -2;
    INT32 i = 0;
    
#ifdef CJT188_DEBUG_ON
    INT32 len = 0;
    S_CJT188_MMDDNN_14 *pMMDDNN = NULL;
#endif

    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        for(i = 0; i < 84; i++)
        {
            sprintf((char*)&pArray[i], "%02d", (UINT8)*(pData+i));
        }

        #ifdef aaaaa//CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 84);
             for(i = 0; i < 84; i++)
             {
                 sprintf(pArray+i, "%02d", 0x12);
             }
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 84);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 42);    
        
        for(i = 0; i < 42; i++ )
        {
            *(pData + i) = cjt188_str_to_num(&acTmp[j+=2], 2);
        }
    
        #ifdef CJT188_DEBUG_ON
        pMMDDNN = (S_CJT188_MMDDNN_14*)user;
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            
            for(i = 0; i < 14; i++)
            {
                len += snprintf(g_out_data_07 + len, sizeof(g_out_data_07),
                                "MMDDNN[%d] : MM = %02d\nDD = %02d\nNN = %02d\n", 
                                i+1,
                                pMMDDNN->MMDDNN[i].MM,
                                pMMDDNN->MMDDNN[i].DD,
                                pMMDDNN->MMDDNN[i].NN);
                
            }
        }
       #endif
    }
    return E_CJT188_OK;
}

eCJT188Err trans_cjt188_data_hhmmNN_14(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    char acTmp[84] = {0};
    INT32 i = 0;
    INT32 j = -2;
    UINT8 *pData = (UINT8*)user;
    UINT8 *pArray = (UINT8*)acTmp;
#ifdef CJT188_DEBUG_ON
    S_CJT188_hhmmNN_14 *phhmmNN = NULL;
    INT32 len = 0;
#endif
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        for(i = 0; i < 84; i++)
        {
            sprintf((char*)(pArray+i), "%02d", (UINT8)*(pData+i));
        }

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 84);
             for(i = 0; i < 84; i++)
             {
                 sprintf((char*)(pArray+i), "%02d", 0x12);
             }
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 84);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 42);    
        
        for(i = 0; i < 42; i++ )
        {
            *(pData + i) = cjt188_str_to_num(&acTmp[j+=2], 2);
        }
    
        #ifdef CJT188_DEBUG_ON
        phhmmNN = (S_CJT188_hhmmNN_14*)user;
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            
            for(i = 0; i < 14; i++)
            {
                len += sprintf(g_out_data_07 + len,
                                "phhmmNN[%d] : mm = %02d\nhh = %02d\nss = %02d\n", 
                                i+1,
                                phhmmNN->hhmmNN[i].hh,
                                phhmmNN->hhmmNN[i].mm,
                                phhmmNN->hhmmNN[i].NN);
                
            }
        }
       #endif
    }
    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_hhmmss
 功能描述  : hhmmss结构转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_hhmmss(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{    
    S_CJT188_hhmmss *phhmmss = (S_CJT188_hhmmss*)user;
    char acTmp[10] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }

    if(E_CJT188_TRANS_U2F == flag)
    {
        
        snprintf(acTmp, sizeof(acTmp),
                "%02d%02d%02d", 
                phhmmss->hh,
                phhmmss->mm,
                phhmmss->ss);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 7);
            printf("\t(hhmmss) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 6);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 3);        
        
        phhmmss->hh = cjt188_str_to_num(&acTmp[i], 2);
        phhmmss->mm = cjt188_str_to_num(&acTmp[i+=2], 2);
        phhmmss->ss = cjt188_str_to_num(&acTmp[i+=2], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                    "mm = %02d\nhh = %02d\nss = %02d\n", 
                    phhmmss->mm,
                    phhmmss->hh,
                    phhmmss->ss);
        }
       #endif
    }
    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_DDhh
 功能描述  : DDhh结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月29日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_DDhh(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_DDhh *pDDhh = NULL;
    char acTmp[7] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }

    pDDhh = (S_CJT188_DDhh*)user;
    if(E_CJT188_TRANS_U2F == flag)
    {        
        snprintf(acTmp, sizeof(acTmp),
                "%02d%02d", 
                pDDhh->DD,
                pDDhh->hh);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 5);
            printf("\t(DDhh) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame,4);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 2);        
        
        pDDhh->DD = cjt188_str_to_num(&acTmp[i], 2);
        pDDhh->hh = cjt188_str_to_num(&acTmp[i+=2], 2);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                    "DD = %02d\nhh = %02d\n", 
                    pDDhh->DD,
                    pDDhh->hh);
        }
       #endif
    }
    return E_CJT188_OK;
}

//MMDDhhmm
eCJT188Err trans_cjt188_data_MMDDhhmm(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_MMDDhhmm *pMMDDhhmm = NULL;
    char acTmp[13] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    pMMDDhhmm = (S_CJT188_MMDDhhmm*)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        
        snprintf(acTmp, sizeof(acTmp),
                "%02d%02d%02d%02d", 
                pMMDDhhmm->MM,
                pMMDDhhmm->DD,
                pMMDDhhmm->hh,
                pMMDDhhmm->mm);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 9);
            printf("\t(MMDDhhmm) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 8);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 4);        
    
        pMMDDhhmm->MM = cjt188_str_to_num(&acTmp[i], 2);
        pMMDDhhmm->DD = cjt188_str_to_num(&acTmp[i+=2], 2);
        pMMDDhhmm->hh = cjt188_str_to_num(&acTmp[i+=2], 2);
        pMMDDhhmm->mm = cjt188_str_to_num(&acTmp[i+=2], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                    "MM = %02d\nDD = %02d\nhh = %02d\nmm = %02d\n", 
                    pMMDDhhmm->MM,
                    pMMDDhhmm->DD,
                    pMMDDhhmm->hh,
                    pMMDDhhmm->mm);
        }
       #endif
    }

    return E_CJT188_OK;
}

//YYMMDDWW 结构转换
eCJT188Err trans_cjt188_data_YYMMDDWW(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_YYMMDDWW *pYYMMDDWW = NULL;
    char acTmp[13] = {0};
    INT32 i = 0;
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    pYYMMDDWW = (S_CJT188_YYMMDDWW*)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        
        sprintf(acTmp, 
                "%02d%02d%02d%02d", 
                pYYMMDDWW->YY,
                pYYMMDDWW->MM,
                pYYMMDDWW->DD,
                pYYMMDDWW->WW);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 9);
            printf("\t(YYMMDDWW) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 8);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 4);        

        pYYMMDDWW->YY = cjt188_str_to_num(&acTmp[i], 2);
        pYYMMDDWW->MM = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDWW->DD = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDWW->WW = cjt188_str_to_num(&acTmp[i+=2], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07,
                    "YY = %02d\nMM = %02d\nDD = %02d\nWW = %02d\n", 
                    pYYMMDDWW->YY,
                    pYYMMDDWW->MM,
                    pYYMMDDWW->DD,
                    pYYMMDDWW->WW);
        }
       #endif
    }

    return E_CJT188_OK;
}

//YYMMDDNN
eCJT188Err trans_cjt188_data_YYMMDDNN(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_YYMMDDNN *pYYMMDDNN = NULL;
    char acTmp[13] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {

        return E_CJT188_ERRO_NULL;
    }
    
    pYYMMDDNN = (S_CJT188_YYMMDDNN*)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        snprintf(acTmp, sizeof(acTmp),
                "%02d%02d%02d%02d", 
                pYYMMDDNN->YY,
                pYYMMDDNN->MM,
                pYYMMDDNN->DD,
                pYYMMDDNN->NN);

        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void*)acTmp, 0x00, 9);
            printf("\t(YYMMDDNN) << ");
            scanf("%s",(char*)&acTmp);
        }
        #endif
        cjt188_str2bcd(acTmp, (UINT8*)frame, 8);
    }
    else // frame to user
    {
        cjt188_bcd2str(frame, acTmp, 4);        
    
        pYYMMDDNN->YY = cjt188_str_to_num(&acTmp[i], 2);
        pYYMMDDNN->MM = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDNN->DD = cjt188_str_to_num(&acTmp[i+=2], 2);
        pYYMMDDNN->NN = cjt188_str_to_num(&acTmp[i+=2], 2);
    
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            snprintf(g_out_data_07,  sizeof(g_out_data_07),
                    "YY = %02d\nMM = %02d\nDD = %02d\nNN = %02d\n", 
                    pYYMMDDNN->YY,
                    pYYMMDDNN->MM,
                    pYYMMDDNN->DD,
                    pYYMMDDNN->NN);
        }
       #endif
    }

    return E_CJT188_OK;
}


// XX.XXXXYYMMDDhhmm
eCJT188Err trans_cjt188_data_XX_XXXX_YYMMDDhhmm(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{
    S_CJT188_XX_XXXX_YYMMDDhhmm *pDataUser = NULL;
    char str[331] = {0};
    char strOut[16] = {0};
    char acXX_XXXX[8] = {0};
    
#ifdef CJT188_DEBUG_ON
        INT32 outLen = 0;
#endif

    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    pDataUser = (S_CJT188_XX_XXXX_YYMMDDhhmm *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        
        snprintf(str,  sizeof(str),"%2.4f%d%d%d%d%d",
            pDataUser->fXX_XXXX,
            pDataUser->YY,
            pDataUser->MM,
            pDataUser->DD,
            pDataUser->hh,
            pDataUser->mm);
    
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            printf("\t(XX.XXXXYYMMDDhhmm) << ");
            scanf("%s", (char*)&str);
        }
        #endif
        
        cjt188_remove_dot(16,str, strOut);
        cjt188_str2bcd(strOut, (UINT8*)frame, 16);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, str,8);
        cjt188_add_dot(6, str, acXX_XXXX, 2);        
        pDataUser->fXX_XXXX = atof(acXX_XXXX);
        pDataUser->YY = cjt188_str_to_num(&str[6],2);
        pDataUser->MM = cjt188_str_to_num(&str[8],2);
        pDataUser->DD = cjt188_str_to_num(&str[10],2);
        pDataUser->hh = cjt188_str_to_num(&str[12],2);
        pDataUser->mm = cjt188_str_to_num(&str[14],2);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            outLen += sprintf(g_out_data_07 + outLen, "XX.XXXX =  %2.4f\n", pDataUser->fXX_XXXX);
            outLen += sprintf(g_out_data_07 + outLen, "      YY =   %02d\n", pDataUser->YY);
            outLen += sprintf(g_out_data_07 + outLen, "      MM =   %02d\n", pDataUser->MM);
            outLen += sprintf(g_out_data_07 + outLen, "      DD =   %02d\n", pDataUser->DD);
            outLen += sprintf(g_out_data_07 + outLen, "      hh =   %02d\n", pDataUser->hh);
            outLen += sprintf(g_out_data_07 + outLen, "      mm =   %02d\n", pDataUser->mm);
        }
        #endif
    }

    return E_CJT188_OK;
}
/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_loss_less_volt
 功能描述  : 失压或欠压记录数据结构用户侧到帧侧转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月22日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_loss_less_volt(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{

    S_CJT188_LESS_LOSS_VOLT *pDataUser = NULL;

    #define BUF_SIZE     313
    #define BUF_OUT_BCD_SIZE 131
    #define BUF_OUT_SIZE    262
    INT32 i = 0;
    char strUsr[BUF_SIZE] = {0};
    char strBcd[BUF_SIZE] = {0};
    
    #ifdef CJT188_DEBUG_ON
    S_CJT188_LESS_LOSS_VOLT sTest ;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_LESS_LOSS_VOLT *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            
            pDataUser = (S_CJT188_LESS_LOSS_VOLT*)&sTest;
            
            sTest.sBgnTime.YY = 0x07;
            sTest.sBgnTime.MM = 0x07;
            sTest.sBgnTime.DD = 0x07;
            sTest.sBgnTime.hh = 0x07;
            sTest.sBgnTime.mm = 0x07;
            sTest.sBgnTime.ss = 0x07;
            
            sTest.sEndTime.YY = 0x08;
            sTest.sEndTime.MM = 0x08;
            sTest.sEndTime.DD = 0x08;
            sTest.sEndTime.hh = 0x08;
            sTest.sEndTime.mm = 0x08;
            sTest.sEndTime.ss = 0x08;
            
            //sPowerTotal
            sTest.sPowerTotal.dForthHavePowerIcr = 123456.78;
            sTest.sPowerTotal.dBackHavePowerIcr  = 123456.78;
            sTest.sPowerTotal.dCombNone1PowerIcr = 123456.78;
            sTest.sPowerTotal.dCombNone2PowerIcr = 123456.78;
            //sPowerA
            sTest.sPowerA.dForthHavePowerIcr = 123456.78;
            sTest.sPowerA.dBackHavePowerIcr = 123456.78;
            sTest.sPowerA.dCombNone1PowerIcr = 123456.78;
            sTest.sPowerA.dCombNone2PowerIcr = 123456.78;
            //sFactorA
            sTest.sFactorA.fVolt = 123.4;
            sTest.sFactorA.fElec= 123.456;
            sTest.sFactorA.fHavePowerRate = 12.3456;
            sTest.sFactorA.fNonePowerRate= 12.3456;
            sTest.sFactorA.fPowerRateFactor = 1.234;
            //sPowerB
            sTest.sPowerB.dForthHavePowerIcr= 123456.78;
            sTest.sPowerB.dBackHavePowerIcr= 123456.78;
            sTest.sPowerB.dCombNone1PowerIcr= 123456.78;
            sTest.sPowerB.dCombNone2PowerIcr= 123456.78;
            //sFactorB
            sTest.sFactorB.fVolt = 123.4;
            sTest.sFactorB.fElec= 123.456;
            sTest.sFactorB.fHavePowerRate = 12.3456;
            sTest.sFactorB.fNonePowerRate= 12.3456;
            sTest.sFactorB.fPowerRateFactor = 1.234;
            //sPowerA
            sTest.sPowerC.dForthHavePowerIcr= 123456.78;
            sTest.sPowerC.dBackHavePowerIcr= 123456.78;
            sTest.sPowerC.dCombNone1PowerIcr= 123456.78;
            sTest.sPowerC.dCombNone2PowerIcr= 123456.78;
            //sFactorA
            sTest.sFactorC.fVolt = 123.4;
            sTest.sFactorC.fElec= 123.456;
            sTest.sFactorC.fHavePowerRate = 12.3456;
            sTest.sFactorC.fNonePowerRate= 12.3456;
            sTest.sFactorC.fPowerRateFactor = 1.234;
            // sAtime
            sTest.sAtime.dAtimeTotal= 123456.78;
            sTest.sAtime.dAtimePhaseA= 123456.78;
            sTest.sAtime.dAtimePhaseB= 123456.78;
            sTest.sAtime.dAtimePhaseC = 123456.78;

        }
        #endif
        
        /* start time  字节总长 297*/
        snprintf(strUsr, sizeof(strUsr), "%02d%02d%02d%02d%02d%02d"         //sBgnTime
                        "%02d%02d%02d%02d%02d%02d"        //end time
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerTotal
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerA
                        "%05.1f%07.3f%07.4f%07.4f%05.3f"//sFactorA
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerB
                        "%05.1f%07.3f%07.4f%07.4f%05.3f"//sFactorB
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerC
                        "%05.1f%07.3f%07.4f%07.4f%05.3f"//sFactorC
                        "%09.2f%09.2f%09.2f%09.2f",        //sAtime
                        //sBgnTime
                        pDataUser->sBgnTime.YY,
                        pDataUser->sBgnTime.MM,
                        pDataUser->sBgnTime.DD,    
                        pDataUser->sBgnTime.hh,
                        pDataUser->sBgnTime.mm,
                        pDataUser->sBgnTime.ss,
                        //sEndTime
                        pDataUser->sEndTime.YY,
                        pDataUser->sEndTime.MM,
                        pDataUser->sEndTime.DD,    
                        pDataUser->sEndTime.hh,
                        pDataUser->sEndTime.mm,
                        pDataUser->sEndTime.ss,
                        //sPowerTotal
                        pDataUser->sPowerTotal.dForthHavePowerIcr,
                        pDataUser->sPowerTotal.dBackHavePowerIcr,
                        pDataUser->sPowerTotal.dCombNone1PowerIcr,
                        pDataUser->sPowerTotal.dCombNone2PowerIcr,
                        //sPowerA
                        pDataUser->sPowerA.dForthHavePowerIcr,
                        pDataUser->sPowerA.dBackHavePowerIcr,
                        pDataUser->sPowerA.dCombNone1PowerIcr,
                        pDataUser->sPowerA.dCombNone2PowerIcr,
                        //sFactorA
                        pDataUser->sFactorA.fVolt,
                        pDataUser->sFactorA.fElec,
                        pDataUser->sFactorA.fHavePowerRate,
                        pDataUser->sFactorA.fNonePowerRate,
                        pDataUser->sFactorA.fPowerRateFactor,
                        //sPowerB
                        pDataUser->sPowerB.dForthHavePowerIcr,
                        pDataUser->sPowerB.dBackHavePowerIcr,
                        pDataUser->sPowerB.dCombNone1PowerIcr,
                        pDataUser->sPowerB.dCombNone2PowerIcr,
                        //sFactorB
                        pDataUser->sFactorB.fVolt,
                        pDataUser->sFactorB.fElec,
                        pDataUser->sFactorB.fHavePowerRate,
                        pDataUser->sFactorB.fNonePowerRate,
                        pDataUser->sFactorB.fPowerRateFactor,
                        //sPowerA
                        pDataUser->sPowerC.dForthHavePowerIcr,
                        pDataUser->sPowerC.dBackHavePowerIcr,
                        pDataUser->sPowerC.dCombNone1PowerIcr,
                        pDataUser->sPowerC.dCombNone2PowerIcr,
                        //sFactorA
                        pDataUser->sFactorC.fVolt,
                        pDataUser->sFactorC.fElec,
                        pDataUser->sFactorC.fHavePowerRate,
                        pDataUser->sFactorC.fNonePowerRate,
                        pDataUser->sFactorC.fPowerRateFactor,
                        // sAtime
                        pDataUser->sAtime.dAtimeTotal,
                        pDataUser->sAtime.dAtimePhaseA,
                        pDataUser->sAtime.dAtimePhaseB,
                        pDataUser->sAtime.dAtimePhaseC);//297
        
        cjt188_remove_dot(BUF_OUT_SIZE,strUsr, strBcd);
        cjt188_str2bcd(strBcd, (UINT8*)frame, BUF_OUT_SIZE);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr,BUF_OUT_BCD_SIZE);

        pDataUser->sBgnTime.YY = cjt188_str_to_num(&strUsr[i], 2);
        pDataUser->sBgnTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        
        pDataUser->sEndTime.YY = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sPowerTotal

        pDataUser->sPowerTotal.dForthHavePowerIcr = cjt188_str_to_double(&strUsr[i+=2],8,6);
        pDataUser->sPowerTotal.dBackHavePowerIcr  = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerTotal.dCombNone1PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerTotal.dCombNone2PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPowerA
        pDataUser->sPowerA.dForthHavePowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dBackHavePowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dCombNone1PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dCombNone2PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sFactorA
        pDataUser->sFactorA.fVolt = cjt188_str_to_double(&strUsr[i+=8], 4, 3);
        pDataUser->sFactorA.fElec= cjt188_str_to_double(&strUsr[i+=4], 6, 3);
        pDataUser->sFactorA.fHavePowerRate = cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorA.fNonePowerRate= cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorA.fPowerRateFactor = cjt188_str_to_double(&strUsr[i+=6], 4, 1);
        //sPowerB
        pDataUser->sPowerB.dForthHavePowerIcr= cjt188_str_to_double(&strUsr[i+=4], 8, 6);
        pDataUser->sPowerB.dBackHavePowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dCombNone1PowerIcr= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dCombNone2PowerIcr= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sFactorB
        pDataUser->sFactorB.fVolt = cjt188_str_to_double(&strUsr[i+=8], 4, 3);
        pDataUser->sFactorB.fElec= cjt188_str_to_double(&strUsr[i+=4], 6, 3);
        pDataUser->sFactorB.fHavePowerRate = cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorB.fNonePowerRate= cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorB.fPowerRateFactor = cjt188_str_to_double(&strUsr[i+=6], 4, 1);
        //sPowerc
        pDataUser->sPowerC.dForthHavePowerIcr= cjt188_str_to_double(&strUsr[i+=4], 8, 6);
        pDataUser->sPowerC.dBackHavePowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dCombNone1PowerIcr= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dCombNone2PowerIcr= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sFactorc
        pDataUser->sFactorC.fVolt = cjt188_str_to_double(&strUsr[i+=8], 4, 3);
        pDataUser->sFactorC.fElec= cjt188_str_to_double(&strUsr[i+=4], 6, 3);
        pDataUser->sFactorC.fHavePowerRate = cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorC.fNonePowerRate= cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorC.fPowerRateFactor = cjt188_str_to_double(&strUsr[i+=6], 4, 1);
        // sAtime
        pDataUser->sAtime.dAtimeTotal= cjt188_str_to_double(&strUsr[i+=4], 8, 6);
        pDataUser->sAtime.dAtimePhaseA= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sAtime.dAtimePhaseB= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sAtime.dAtimePhaseC =  cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "sBgnTime = %02d%02d%02d%02d%02d%02d\n"         //sBgnTime
                                    "sEndTime = %02d%02d%02d%02d%02d%02d\n"        //end time
                                    "sPowerTotal = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerTotal
                                    "sPowerA = %09.2f %09.2f %09.2f% 09.2f\n"        //sPowerA
                                    "sFactorA = %05.1f %07.3f %07.4f %07.4f %05.3f\n"//sFactorA
                                    "sPowerB = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerB
                                    "sFactorB = %05.1f %07.3f %07.4f %07.4f %05.3f\n"//sFactorB
                                    "sPowerC = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerC
                                    "sFactorC = %05.1f %07.3f %07.4f %07.4f %05.3f\n"//sFactorC
                                    "sAtime = %09.2f %09.2f %09.2f %09.2f\n",        //sAtime
                                    //sBgnTime
                                    pDataUser->sBgnTime.YY,
                                    pDataUser->sBgnTime.MM,
                                    pDataUser->sBgnTime.DD,    
                                    pDataUser->sBgnTime.hh,
                                    pDataUser->sBgnTime.mm,
                                    pDataUser->sBgnTime.ss,
                                    //sEndTime
                                    pDataUser->sEndTime.YY,
                                    pDataUser->sEndTime.MM,
                                    pDataUser->sEndTime.DD,    
                                    pDataUser->sEndTime.hh,
                                    pDataUser->sEndTime.mm,
                                    pDataUser->sEndTime.ss,
                                    //sPowerTotal
                                    pDataUser->sPowerTotal.dForthHavePowerIcr,
                                    pDataUser->sPowerTotal.dBackHavePowerIcr,
                                    pDataUser->sPowerTotal.dCombNone1PowerIcr,
                                    pDataUser->sPowerTotal.dCombNone2PowerIcr,
                                    //sPowerA
                                    pDataUser->sPowerA.dForthHavePowerIcr,
                                    pDataUser->sPowerA.dBackHavePowerIcr,
                                    pDataUser->sPowerA.dCombNone1PowerIcr,
                                    pDataUser->sPowerA.dCombNone2PowerIcr,
                                    //sFactorA
                                    pDataUser->sFactorA.fVolt,
                                    pDataUser->sFactorA.fElec,
                                    pDataUser->sFactorA.fHavePowerRate,
                                    pDataUser->sFactorA.fNonePowerRate,
                                    pDataUser->sFactorA.fPowerRateFactor,
                                    //sPowerB
                                    pDataUser->sPowerB.dForthHavePowerIcr,
                                    pDataUser->sPowerB.dBackHavePowerIcr,
                                    pDataUser->sPowerB.dCombNone1PowerIcr,
                                    pDataUser->sPowerB.dCombNone2PowerIcr,
                                    //sFactorB
                                    pDataUser->sFactorB.fVolt,
                                    pDataUser->sFactorB.fElec,
                                    pDataUser->sFactorB.fHavePowerRate,
                                    pDataUser->sFactorB.fNonePowerRate,
                                    pDataUser->sFactorB.fPowerRateFactor,
                                    //sPowerA
                                    pDataUser->sPowerC.dForthHavePowerIcr,
                                    pDataUser->sPowerC.dBackHavePowerIcr,
                                    pDataUser->sPowerC.dCombNone1PowerIcr,
                                    pDataUser->sPowerC.dCombNone2PowerIcr,
                                    //sFactorA
                                    pDataUser->sFactorC.fVolt,
                                    pDataUser->sFactorC.fElec,
                                    pDataUser->sFactorC.fHavePowerRate,
                                    pDataUser->sFactorC.fNonePowerRate,
                                    pDataUser->sFactorC.fPowerRateFactor,
                                    // sAtime
                                    pDataUser->sAtime.dAtimeTotal,
                                    pDataUser->sAtime.dAtimePhaseA,
                                    pDataUser->sAtime.dAtimePhaseB,
                                    pDataUser->sAtime.dAtimePhaseC);//297
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_anti_phase
 功能描述  : 电压逆序等数据结构用户侧和帧侧结构转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月23日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_anti_phase(E_CJT188_TRANS_FLG flag, char *user, char *frame)// 逆相序数据格式
{

    S_CJT188_EventRevPhase *pDataUser = NULL;
    INT32 i = 0;
    #define BUF_SIZE_ANTI_PHASE 300
    #define BUF_OUT_BCD_SIZE_ANTI_PHASE 76
    #define BUF_OUT_SIZE_ANTI_PHASE    152
    char strUsr[BUF_SIZE_ANTI_PHASE] = {0};
    char strBcd[BUF_SIZE_ANTI_PHASE] = {0};
    
#ifdef CJT188_DEBUG_ON
    S_CJT188_EventRevPhase sTest ;
#endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventRevPhase *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            
            pDataUser = (S_CJT188_EventRevPhase*)&sTest;
            //sBgnTime
            sTest.sBgnTime.YY = 0x07;
            sTest.sBgnTime.MM = 0x07;
            sTest.sBgnTime.DD = 0x07;
            sTest.sBgnTime.hh = 0x07;
            sTest.sBgnTime.mm = 0x07;
            sTest.sBgnTime.ss = 0x07;
            //sEndTime
            sTest.sEndTime.YY = 0x08;
            sTest.sEndTime.MM = 0x08;
            sTest.sEndTime.DD = 0x08;
            sTest.sEndTime.hh = 0x08;
            sTest.sEndTime.mm = 0x08;
            sTest.sEndTime.ss = 0x08;
            //sPowerTotal
            sTest.sPowerTotal.dForthHavePowerIcr = 123456.78;
            sTest.sPowerTotal.dBackHavePowerIcr  = 123456.78;
            sTest.sPowerTotal.dCombNone1PowerIcr = 123456.78;
            sTest.sPowerTotal.dCombNone2PowerIcr = 123456.78;
            //sPowerA
            sTest.sPowerA.dForthHavePowerIcr = 123456.78;
            sTest.sPowerA.dBackHavePowerIcr = 123456.78;
            sTest.sPowerA.dCombNone1PowerIcr = 123456.78;
            sTest.sPowerA.dCombNone2PowerIcr = 123456.78;
            //sPowerB
            sTest.sPowerB.dForthHavePowerIcr= 123456.78;
            sTest.sPowerB.dBackHavePowerIcr= 123456.78;
            sTest.sPowerB.dCombNone1PowerIcr= 123456.78;
            sTest.sPowerB.dCombNone2PowerIcr= 123456.78;
            //sPowerC
            sTest.sPowerC.dForthHavePowerIcr= 123456.78;
            sTest.sPowerC.dBackHavePowerIcr= 123456.78;
            sTest.sPowerC.dCombNone1PowerIcr= 123456.78;
            sTest.sPowerC.dCombNone2PowerIcr= 123456.78;

        }
        #endif
        
        /* start time  字节总长 297*/
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"         //sBgnTime
                        "%02d%02d%02d%02d%02d%02d"        //end time
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerTotal
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerA
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerB
                        "%09.2f%09.2f%09.2f%09.2f",        //sPowerC
                        //sBgnTime
                        pDataUser->sBgnTime.YY,
                        pDataUser->sBgnTime.MM,
                        pDataUser->sBgnTime.DD,    
                        pDataUser->sBgnTime.hh,
                        pDataUser->sBgnTime.mm,
                        pDataUser->sBgnTime.ss,
                        //sEndTime
                        pDataUser->sEndTime.YY,
                        pDataUser->sEndTime.MM,
                        pDataUser->sEndTime.DD,    
                        pDataUser->sEndTime.hh,
                        pDataUser->sEndTime.mm,
                        pDataUser->sEndTime.ss,
                        //sPowerTotal
                        pDataUser->sPowerTotal.dForthHavePowerIcr,
                        pDataUser->sPowerTotal.dBackHavePowerIcr,
                        pDataUser->sPowerTotal.dCombNone1PowerIcr,
                        pDataUser->sPowerTotal.dCombNone2PowerIcr,
                        //sPowerA
                        pDataUser->sPowerA.dForthHavePowerIcr,
                        pDataUser->sPowerA.dBackHavePowerIcr,
                        pDataUser->sPowerA.dCombNone1PowerIcr,
                        pDataUser->sPowerA.dCombNone2PowerIcr,
                        //sPowerB
                        pDataUser->sPowerB.dForthHavePowerIcr,
                        pDataUser->sPowerB.dBackHavePowerIcr,
                        pDataUser->sPowerB.dCombNone1PowerIcr,
                        pDataUser->sPowerB.dCombNone2PowerIcr,
                        //sPowerA
                        pDataUser->sPowerC.dForthHavePowerIcr,
                        pDataUser->sPowerC.dBackHavePowerIcr,
                        pDataUser->sPowerC.dCombNone1PowerIcr,
                        pDataUser->sPowerC.dCombNone2PowerIcr);//204
                        
        cjt188_remove_dot(BUF_OUT_SIZE_ANTI_PHASE,strUsr, strBcd);
        cjt188_str2bcd(strBcd, (UINT8*)frame, BUF_OUT_SIZE_ANTI_PHASE/2);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, BUF_OUT_BCD_SIZE_ANTI_PHASE);

        //sBgnTime
        pDataUser->sBgnTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sBgnTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sEndTime
        pDataUser->sEndTime.YY = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sPowerTotal
        pDataUser->sPowerTotal.dForthHavePowerIcr = cjt188_str_to_double(&strUsr[i+=2], 8, 6);
        pDataUser->sPowerTotal.dBackHavePowerIcr  = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerTotal.dCombNone1PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerTotal.dCombNone2PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPowerA
        pDataUser->sPowerA.dForthHavePowerIcr       = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dBackHavePowerIcr        = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dCombNone1PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dCombNone2PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPowerB
        pDataUser->sPowerB.dForthHavePowerIcr      = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dBackHavePowerIcr       = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dCombNone1PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dCombNone2PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPowerc
        pDataUser->sPowerC.dForthHavePowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dBackHavePowerIcr      = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dCombNone1PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dCombNone2PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "sBgnTime = %02d%02d%02d%02d%02d%02d\n"         //sBgnTime
                                    "sEndTime = %02d%02d%02d%02d%02d%02d\n"        //end time
                                    "sPowerTotal = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerTotal
                                    "sPowerA = %09.2f %09.2f %09.2f% 09.2f\n"        //sPowerA
                                    "sPowerB = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerB
                                    "sPowerC = %09.2f %09.2f %09.2f %09.2f\n",        //sPowerC
                                    //sBgnTime
                                    pDataUser->sBgnTime.YY,
                                    pDataUser->sBgnTime.MM,
                                    pDataUser->sBgnTime.DD,    
                                    pDataUser->sBgnTime.hh,
                                    pDataUser->sBgnTime.mm,
                                    pDataUser->sBgnTime.ss,
                                    //sEndTime
                                    pDataUser->sEndTime.YY,
                                    pDataUser->sEndTime.MM,
                                    pDataUser->sEndTime.DD,    
                                    pDataUser->sEndTime.hh,
                                    pDataUser->sEndTime.mm,
                                    pDataUser->sEndTime.ss,
                                    //sPowerTotal
                                    pDataUser->sPowerTotal.dForthHavePowerIcr,
                                    pDataUser->sPowerTotal.dBackHavePowerIcr,
                                    pDataUser->sPowerTotal.dCombNone1PowerIcr,
                                    pDataUser->sPowerTotal.dCombNone2PowerIcr,
                                    //sPowerA
                                    pDataUser->sPowerA.dForthHavePowerIcr,
                                    pDataUser->sPowerA.dBackHavePowerIcr,
                                    pDataUser->sPowerA.dCombNone1PowerIcr,
                                    pDataUser->sPowerA.dCombNone2PowerIcr,
                                    //sPowerB
                                    pDataUser->sPowerB.dForthHavePowerIcr,
                                    pDataUser->sPowerB.dBackHavePowerIcr,
                                    pDataUser->sPowerB.dCombNone1PowerIcr,
                                    pDataUser->sPowerB.dCombNone2PowerIcr,
                                    //sPowerA
                                    pDataUser->sPowerC.dForthHavePowerIcr,
                                    pDataUser->sPowerC.dBackHavePowerIcr,
                                    pDataUser->sPowerC.dCombNone1PowerIcr,
                                    pDataUser->sPowerC.dCombNone2PowerIcr);
        }
        #endif
    }

    return E_CJT188_OK;
}
/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_un_balance
 功能描述  : 电压不平衡记录事件结构用户侧到帧侧结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月23日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_un_balance(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventUnBalance *pDataUser = NULL;
    INT32 i = 0;
    #define BUF_SIZE_ANTI_PHASE 300
    #define BUF_OUT_BCD_SIZE_UN_BALANCE 78
    #define BUF_OUT_SIZE_UN_BALANCE   156
    
    char strUsr[BUF_SIZE_ANTI_PHASE] = {0};
    char strBcd[BUF_SIZE_ANTI_PHASE] = {0};
    #ifdef CJT188_DEBUG_ON
    S_CJT188_EventUnBalance sTest ;
    #endif
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventUnBalance *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
        
            pDataUser = (S_CJT188_EventUnBalance*)&sTest;
            //sBgnTime
            sTest.sBgnTime.YY = 0x07;
            sTest.sBgnTime.MM = 0x07;
            sTest.sBgnTime.DD = 0x07;
            sTest.sBgnTime.hh = 0x07;
            sTest.sBgnTime.mm = 0x07;
            sTest.sBgnTime.ss = 0x07;
            //sEndTime
            sTest.sEndTime.YY = 0x08;
            sTest.sEndTime.MM = 0x08;
            sTest.sEndTime.DD = 0x08;
            sTest.sEndTime.hh = 0x08;
            sTest.sEndTime.mm = 0x08;
            sTest.sEndTime.ss = 0x08;
            //sPowerTotal
            sTest.sPowerTotal.dForthHavePowerIcr = 123456.78;
            sTest.sPowerTotal.dBackHavePowerIcr  = 123456.78;
            sTest.sPowerTotal.dCombNone1PowerIcr = 123456.78;
            sTest.sPowerTotal.dCombNone2PowerIcr = 123456.78;
            //sPowerA
            sTest.sPowerA.dForthHavePowerIcr = 123456.78;
            sTest.sPowerA.dBackHavePowerIcr = 123456.78;
            sTest.sPowerA.dCombNone1PowerIcr = 123456.78;
            sTest.sPowerA.dCombNone2PowerIcr = 123456.78;
            //sPowerB
            sTest.sPowerB.dForthHavePowerIcr= 123456.78;
            sTest.sPowerB.dBackHavePowerIcr= 123456.78;
            sTest.sPowerB.dCombNone1PowerIcr= 123456.78;
            sTest.sPowerB.dCombNone2PowerIcr= 123456.78;
            //sPowerC
            sTest.sPowerC.dForthHavePowerIcr= 123456.78;
            sTest.sPowerC.dBackHavePowerIcr= 123456.78;
            sTest.sPowerC.dCombNone1PowerIcr= 123456.78;
            sTest.sPowerC.dCombNone2PowerIcr= 123456.78;

        }
        #endif
        
        /* start time  字节总长 297*/
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"         //sBgnTime
                        "%02d%02d%02d%02d%02d%02d"        //end time
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerTotal
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerA
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerB
                        "%09.2f%09.2f%09.2f%09.2f",        //sPowerC
                        //sBgnTime
                        pDataUser->sBgnTime.YY,
                        pDataUser->sBgnTime.MM,
                        pDataUser->sBgnTime.DD,    
                        pDataUser->sBgnTime.hh,
                        pDataUser->sBgnTime.mm,
                        pDataUser->sBgnTime.ss,
                        //sEndTime
                        pDataUser->sEndTime.YY,
                        pDataUser->sEndTime.MM,
                        pDataUser->sEndTime.DD,    
                        pDataUser->sEndTime.hh,
                        pDataUser->sEndTime.mm,
                        pDataUser->sEndTime.ss,
                        //sPowerTotal
                        pDataUser->sPowerTotal.dForthHavePowerIcr,
                        pDataUser->sPowerTotal.dBackHavePowerIcr,
                        pDataUser->sPowerTotal.dCombNone1PowerIcr,
                        pDataUser->sPowerTotal.dCombNone2PowerIcr,
                        //sPowerA
                        pDataUser->sPowerA.dForthHavePowerIcr,
                        pDataUser->sPowerA.dBackHavePowerIcr,
                        pDataUser->sPowerA.dCombNone1PowerIcr,
                        pDataUser->sPowerA.dCombNone2PowerIcr,
                        //sPowerB
                        pDataUser->sPowerB.dForthHavePowerIcr,
                        pDataUser->sPowerB.dBackHavePowerIcr,
                        pDataUser->sPowerB.dCombNone1PowerIcr,
                        pDataUser->sPowerB.dCombNone2PowerIcr,
                        //sPowerA
                        pDataUser->sPowerC.dForthHavePowerIcr,
                        pDataUser->sPowerC.dBackHavePowerIcr,
                        pDataUser->sPowerC.dCombNone1PowerIcr,
                        pDataUser->sPowerC.dCombNone2PowerIcr);//204
        
        cjt188_remove_dot(BUF_OUT_SIZE_UN_BALANCE,strUsr, strBcd);
        cjt188_str2bcd(strBcd, (UINT8*)frame, BUF_OUT_SIZE_UN_BALANCE/2);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, BUF_OUT_BCD_SIZE_UN_BALANCE);

        //sBgnTime
        pDataUser->sBgnTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sBgnTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sEndTime
        pDataUser->sEndTime.YY = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sPowerTotal
        pDataUser->sPowerTotal.dForthHavePowerIcr = cjt188_str_to_double(&strUsr[i+=2], 8, 6);
        pDataUser->sPowerTotal.dBackHavePowerIcr  = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerTotal.dCombNone1PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerTotal.dCombNone2PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPowerA
        pDataUser->sPowerA.dForthHavePowerIcr       = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dBackHavePowerIcr        = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dCombNone1PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dCombNone2PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPowerB
        pDataUser->sPowerB.dForthHavePowerIcr      = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dBackHavePowerIcr       = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dCombNone1PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dCombNone2PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPowerc
        pDataUser->sPowerC.dForthHavePowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dBackHavePowerIcr      = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dCombNone1PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dCombNone2PowerIcr     = cjt188_str_to_double(&strUsr[i+=8], 8, 6);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "sBgnTime = %02d%02d%02d%02d%02d%02d\n"         //sBgnTime
                                    "sEndTime = %02d%02d%02d%02d%02d%02d\n"        //end time
                                    "sPowerTotal = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerTotal
                                    "sPowerA = %09.2f %09.2f %09.2f% 09.2f\n"        //sPowerA
                                    "sPowerB = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerB
                                    "sPowerC = %09.2f %09.2f %09.2f %09.2f\n",        //sPowerC
                                    //sBgnTime
                                    pDataUser->sBgnTime.YY,
                                    pDataUser->sBgnTime.MM,
                                    pDataUser->sBgnTime.DD,    
                                    pDataUser->sBgnTime.hh,
                                    pDataUser->sBgnTime.mm,
                                    pDataUser->sBgnTime.ss,
                                    //sEndTime
                                    pDataUser->sEndTime.YY,
                                    pDataUser->sEndTime.MM,
                                    pDataUser->sEndTime.DD,    
                                    pDataUser->sEndTime.hh,
                                    pDataUser->sEndTime.mm,
                                    pDataUser->sEndTime.ss,
                                    //sPowerTotal
                                    pDataUser->sPowerTotal.dForthHavePowerIcr,
                                    pDataUser->sPowerTotal.dBackHavePowerIcr,
                                    pDataUser->sPowerTotal.dCombNone1PowerIcr,
                                    pDataUser->sPowerTotal.dCombNone2PowerIcr,
                                    //sPowerA
                                    pDataUser->sPowerA.dForthHavePowerIcr,
                                    pDataUser->sPowerA.dBackHavePowerIcr,
                                    pDataUser->sPowerA.dCombNone1PowerIcr,
                                    pDataUser->sPowerA.dCombNone2PowerIcr,
                                    //sPowerB
                                    pDataUser->sPowerB.dForthHavePowerIcr,
                                    pDataUser->sPowerB.dBackHavePowerIcr,
                                    pDataUser->sPowerB.dCombNone1PowerIcr,
                                    pDataUser->sPowerB.dCombNone2PowerIcr,
                                    //sPowerA
                                    pDataUser->sPowerC.dForthHavePowerIcr,
                                    pDataUser->sPowerC.dBackHavePowerIcr,
                                    pDataUser->sPowerC.dCombNone1PowerIcr,
                                    pDataUser->sPowerC.dCombNone2PowerIcr);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_zone_prog
 功能描述  : 时区表编程记录转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月26日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_zone_prog(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventZone *pDataUser = NULL;
    char strUsr[283] = {0};
    INT32 i = 0;
    #ifdef CJT188_DEBUG_ON
    S_CJT188_EventZone sTest ;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventZone *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {

            pDataUser = (S_CJT188_EventZone*)&sTest;
            //sOccurTime
            sTest.sOccurTime.YY = 0x07;
            sTest.sOccurTime.MM = 0x07;
            sTest.sOccurTime.DD = 0x07;
            sTest.sOccurTime.hh = 0x07;
            sTest.sOccurTime.mm = 0x07;
            sTest.sOccurTime.ss = 0x07;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;

            //sAftTime
            for(i = 0; i < 14; i++)
            {
                sTest.sZoneSet1[i].MM = i+1;
                sTest.sZoneSet1[i].DD = i+1;
                sTest.sZoneSet1[i].NN = i+1;
                
                sTest.sZoneSet2[i].MM = i+2;
                sTest.sZoneSet2[i].DD = i+2;
                sTest.sZoneSet2[i].NN = i+2;
            }
        }
        #endif
        
        snprintf(strUsr,  sizeof(strUsr),
                "%02d%02d%02d%02d%02d%02d"                     //sOccurTime
                "%02d%02d%02d%02d"                            //operator
                "%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d"  //sZoneSet1
                "%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d"  //sZoneSet1
                "%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d"  //sZoneSet1
                "%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d"  //sZoneSet2
                "%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d"  //sZoneSet2
                "%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d", //sZoneSet2
                //sBefTime
                pDataUser->sOccurTime.YY,
                pDataUser->sOccurTime.MM,
                pDataUser->sOccurTime.DD,    
                pDataUser->sOccurTime.hh,
                pDataUser->sOccurTime.mm,
                pDataUser->sOccurTime.ss,
                //operator
                pDataUser->operator[0],
                pDataUser->operator[1],
                pDataUser->operator[2],
                pDataUser->operator[3],

                //sZoneSet1
                pDataUser->sZoneSet1[0].MM,
                pDataUser->sZoneSet1[0].DD,
                pDataUser->sZoneSet1[0].NN,
                pDataUser->sZoneSet1[1].MM,
                pDataUser->sZoneSet1[1].DD,
                pDataUser->sZoneSet1[1].NN,
                pDataUser->sZoneSet1[2].MM,
                pDataUser->sZoneSet1[2].DD,
                pDataUser->sZoneSet1[2].NN,
                pDataUser->sZoneSet1[3].MM,
                pDataUser->sZoneSet1[3].DD,
                pDataUser->sZoneSet1[3].NN,
                pDataUser->sZoneSet1[4].MM,
                pDataUser->sZoneSet1[4].DD,
                pDataUser->sZoneSet1[4].NN,
                pDataUser->sZoneSet1[5].MM,
                pDataUser->sZoneSet1[5].DD,
                pDataUser->sZoneSet1[5].NN,
                pDataUser->sZoneSet1[6].MM,
                pDataUser->sZoneSet1[6].DD,
                pDataUser->sZoneSet1[6].NN,
                pDataUser->sZoneSet1[7].MM,
                pDataUser->sZoneSet1[7].DD,
                pDataUser->sZoneSet1[7].NN,
                pDataUser->sZoneSet1[8].MM,
                pDataUser->sZoneSet1[8].DD,
                pDataUser->sZoneSet1[8].NN,
                pDataUser->sZoneSet1[9].MM,
                pDataUser->sZoneSet1[9].DD,
                pDataUser->sZoneSet1[9].NN,
                pDataUser->sZoneSet1[10].MM,
                pDataUser->sZoneSet1[10].DD,
                pDataUser->sZoneSet1[10].NN,
                pDataUser->sZoneSet1[11].MM,
                pDataUser->sZoneSet1[11].DD,
                pDataUser->sZoneSet1[11].NN,
                pDataUser->sZoneSet1[12].MM,
                pDataUser->sZoneSet1[12].DD,
                pDataUser->sZoneSet1[12].NN,
                pDataUser->sZoneSet1[13].MM,
                pDataUser->sZoneSet1[13].DD,
                pDataUser->sZoneSet1[13].NN,
                //sZoneSet2
                pDataUser->sZoneSet2[0].MM,
                pDataUser->sZoneSet2[0].DD,
                pDataUser->sZoneSet2[0].NN,
                pDataUser->sZoneSet2[1].MM,
                pDataUser->sZoneSet2[1].DD,
                pDataUser->sZoneSet2[1].NN,
                pDataUser->sZoneSet2[2].MM,
                pDataUser->sZoneSet2[2].DD,
                pDataUser->sZoneSet2[2].NN,
                pDataUser->sZoneSet2[3].MM,
                pDataUser->sZoneSet2[3].DD,
                pDataUser->sZoneSet2[3].NN,
                pDataUser->sZoneSet2[4].MM,
                pDataUser->sZoneSet2[4].DD,
                pDataUser->sZoneSet2[4].NN,
                pDataUser->sZoneSet2[5].MM,
                pDataUser->sZoneSet2[5].DD,
                pDataUser->sZoneSet2[5].NN,
                pDataUser->sZoneSet2[6].MM,
                pDataUser->sZoneSet2[6].DD,
                pDataUser->sZoneSet2[6].NN,
                pDataUser->sZoneSet2[7].MM,
                pDataUser->sZoneSet2[7].DD,
                pDataUser->sZoneSet2[7].NN,
                pDataUser->sZoneSet2[8].MM,
                pDataUser->sZoneSet2[8].DD,
                pDataUser->sZoneSet2[8].NN,
                pDataUser->sZoneSet2[9].MM,
                pDataUser->sZoneSet2[9].DD,
                pDataUser->sZoneSet2[9].NN,
                pDataUser->sZoneSet2[10].MM,
                pDataUser->sZoneSet2[10].DD,
                pDataUser->sZoneSet2[10].NN,
                pDataUser->sZoneSet2[11].MM,
                pDataUser->sZoneSet2[11].DD,
                pDataUser->sZoneSet2[11].NN,
                pDataUser->sZoneSet2[12].MM,
                pDataUser->sZoneSet2[12].DD,
                pDataUser->sZoneSet2[12].NN,
                pDataUser->sZoneSet2[13].MM,
                pDataUser->sZoneSet2[13].DD,
                pDataUser->sZoneSet2[13].NN);

        cjt188_str2bcd(strUsr, (UINT8*)frame, 188);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, 94);

        //sBefTime
        pDataUser->sOccurTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sOccurTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //operator
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        
        //sZoneSet1
        pDataUser->sZoneSet1[0].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[0].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[0].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[1].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[1].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[1].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[2].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[2].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[2].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[3].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[3].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[3].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[4].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[4].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[4].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[5].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[5].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[5].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[6].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[6].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[6].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[7].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[7].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[7].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[8].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[8].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[8].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[9].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[9].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[9].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[10].MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[10].DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[10].NN = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[11].MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[11].DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[11].NN = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[12].MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[12].DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[12].NN = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[13].MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[13].DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet1[13].NN = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sZoneSet2
        pDataUser->sZoneSet2[0].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[0].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[0].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[1].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[1].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[1].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[2].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[2].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[2].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[3].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[3].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[3].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[4].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[4].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[4].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[5].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[5].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[5].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[6].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[6].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[6].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[7].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[7].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[7].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[8].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[8].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[8].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[9].MM  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[9].DD  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[9].NN  = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[10].MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[10].DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[10].NN = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[11].MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[11].DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[11].NN = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[12].MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[12].DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[12].NN = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[13].MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[13].DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sZoneSet2[13].NN = cjt188_str_to_num(&strUsr[i+=2], 2);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "sOccurTime = %02d%02d%02d%02d%02d%02d\n"                     //sOccurTime
                    "operator = %02d%02d%02d%02d\n"                            //operator
                    "sZoneSet1 = %02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d\n"  //sZoneSet1
                    "sZoneSet1 = %02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d\n"  //sZoneSet1
                    "sZoneSet1 = %02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d\n"  //sZoneSet1
                    "sZoneSet2 = %02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d\n"  //sZoneSet2
                    "sZoneSet2 = %02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d\n"  //sZoneSet2
                    "sZoneSet2 = %02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d%02d\n", //sZoneSet2
                    //sBefTime
                    pDataUser->sOccurTime.YY,
                    pDataUser->sOccurTime.MM,
                    pDataUser->sOccurTime.DD,    
                    pDataUser->sOccurTime.hh,
                    pDataUser->sOccurTime.mm,
                    pDataUser->sOccurTime.ss,
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],

                    //sZoneSet1
                    pDataUser->sZoneSet1[0].MM,
                    pDataUser->sZoneSet1[0].DD,
                    pDataUser->sZoneSet1[0].NN,
                    pDataUser->sZoneSet1[1].MM,
                    pDataUser->sZoneSet1[1].DD,
                    pDataUser->sZoneSet1[1].NN,
                    pDataUser->sZoneSet1[2].MM,
                    pDataUser->sZoneSet1[2].DD,
                    pDataUser->sZoneSet1[2].NN,
                    pDataUser->sZoneSet1[3].MM,
                    pDataUser->sZoneSet1[3].DD,
                    pDataUser->sZoneSet1[3].NN,
                    pDataUser->sZoneSet1[4].MM,
                    pDataUser->sZoneSet1[4].DD,
                    pDataUser->sZoneSet1[4].NN,
                    pDataUser->sZoneSet1[5].MM,
                    pDataUser->sZoneSet1[5].DD,
                    pDataUser->sZoneSet1[5].NN,
                    pDataUser->sZoneSet1[6].MM,
                    pDataUser->sZoneSet1[6].DD,
                    pDataUser->sZoneSet1[6].NN,
                    pDataUser->sZoneSet1[7].MM,
                    pDataUser->sZoneSet1[7].DD,
                    pDataUser->sZoneSet1[7].NN,
                    pDataUser->sZoneSet1[8].MM,
                    pDataUser->sZoneSet1[8].DD,
                    pDataUser->sZoneSet1[8].NN,
                    pDataUser->sZoneSet1[9].MM,
                    pDataUser->sZoneSet1[9].DD,
                    pDataUser->sZoneSet1[9].NN,
                    pDataUser->sZoneSet1[10].MM,
                    pDataUser->sZoneSet1[10].DD,
                    pDataUser->sZoneSet1[10].NN,
                    pDataUser->sZoneSet1[11].MM,
                    pDataUser->sZoneSet1[11].DD,
                    pDataUser->sZoneSet1[11].NN,
                    pDataUser->sZoneSet1[12].MM,
                    pDataUser->sZoneSet1[12].DD,
                    pDataUser->sZoneSet1[12].NN,
                    pDataUser->sZoneSet1[13].MM,
                    pDataUser->sZoneSet1[13].DD,
                    pDataUser->sZoneSet1[13].NN,
                    //sZoneSet2
                    pDataUser->sZoneSet2[0].MM,
                    pDataUser->sZoneSet2[0].DD,
                    pDataUser->sZoneSet2[0].NN,
                    pDataUser->sZoneSet2[1].MM,
                    pDataUser->sZoneSet2[1].DD,
                    pDataUser->sZoneSet2[1].NN,
                    pDataUser->sZoneSet2[2].MM,
                    pDataUser->sZoneSet2[2].DD,
                    pDataUser->sZoneSet2[2].NN,
                    pDataUser->sZoneSet2[3].MM,
                    pDataUser->sZoneSet2[3].DD,
                    pDataUser->sZoneSet2[3].NN,
                    pDataUser->sZoneSet2[4].MM,
                    pDataUser->sZoneSet2[4].DD,
                    pDataUser->sZoneSet2[4].NN,
                    pDataUser->sZoneSet2[5].MM,
                    pDataUser->sZoneSet2[5].DD,
                    pDataUser->sZoneSet2[5].NN,
                    pDataUser->sZoneSet2[6].MM,
                    pDataUser->sZoneSet2[6].DD,
                    pDataUser->sZoneSet2[6].NN,
                    pDataUser->sZoneSet2[7].MM,
                    pDataUser->sZoneSet2[7].DD,
                    pDataUser->sZoneSet2[7].NN,
                    pDataUser->sZoneSet2[8].MM,
                    pDataUser->sZoneSet2[8].DD,
                    pDataUser->sZoneSet2[8].NN,
                    pDataUser->sZoneSet2[9].MM,
                    pDataUser->sZoneSet2[9].DD,
                    pDataUser->sZoneSet2[9].NN,
                    pDataUser->sZoneSet2[10].MM,
                    pDataUser->sZoneSet2[10].DD,
                    pDataUser->sZoneSet2[10].NN,
                    pDataUser->sZoneSet2[11].MM,
                    pDataUser->sZoneSet2[11].DD,
                    pDataUser->sZoneSet2[11].NN,
                    pDataUser->sZoneSet2[12].MM,
                    pDataUser->sZoneSet2[12].DD,
                    pDataUser->sZoneSet2[12].NN,
                    pDataUser->sZoneSet2[13].MM,
                    pDataUser->sZoneSet2[13].DD,
                    pDataUser->sZoneSet2[13].NN);
        }
        #endif
    }

    return E_CJT188_OK;
}


// 有些结构还是不明白
eCJT188Err trans_cjt188_data_recd_part_prog(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    #ifdef CJT188_DEBUG_ON
    

    #endif
    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_adjust_time
 功能描述  : 校时事件数据结构转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月26日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_adjust_time(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventTiming *pDataUser = NULL;
    char strUsr[128] = {0};
    INT32 i = 0;
    
    #ifdef CJT188_DEBUG_ON
    S_CJT188_EventTiming sTest ;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    pDataUser = (S_CJT188_EventTiming *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            pDataUser = (S_CJT188_EventTiming*)&sTest;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;
            //sOccurTime
            sTest.sBefTime.YY = 0x17;
            sTest.sBefTime.MM = 0x17;
            sTest.sBefTime.DD = 0x17;
            sTest.sBefTime.hh = 0x17;
            sTest.sBefTime.mm = 0x17;
            sTest.sBefTime.ss = 0x17;
            //sAftTime
            sTest.sAftTime.YY = 0x18;
            sTest.sAftTime.MM = 0x18;
            sTest.sAftTime.DD = 0x18;
            sTest.sAftTime.hh = 0x18;
            sTest.sAftTime.mm = 0x18;
            sTest.sAftTime.ss = 0x18;
            
        }
        #endif
        
        sprintf(strUsr, 
                "%02d%02d%02d%02d"                            //operator
                "%02d%02d%02d%02d%02d%02d"                     //sBefTime
                "%02d%02d%02d%02d%02d%02d",                 //sAftTime    
                //operator
                pDataUser->operator[0],
                pDataUser->operator[1],
                pDataUser->operator[2],
                pDataUser->operator[3],
                //sBefTime
                pDataUser->sBefTime.YY,
                pDataUser->sBefTime.MM,
                pDataUser->sBefTime.DD,    
                pDataUser->sBefTime.hh,
                pDataUser->sBefTime.mm,
                pDataUser->sBefTime.ss,
                //sAftTime
                pDataUser->sAftTime.YY,
                pDataUser->sAftTime.MM,
                pDataUser->sAftTime.DD,    
                pDataUser->sAftTime.hh,
                pDataUser->sAftTime.mm,
                pDataUser->sAftTime.ss);

        cjt188_str2bcd(strUsr, (UINT8*)frame, 32);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, 16);

        //operator
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sBefTime
        pDataUser->sBefTime.YY = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBefTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBefTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBefTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBefTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBefTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sAftTime
        pDataUser->sAftTime.YY = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sAftTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sAftTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sAftTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sAftTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sAftTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "operator = %02d%02d%02d%02d\n"                            //operator
                    "sBefTime = %02d%02d%02d%02d%02d%02d\n"                 //sBefTime
                    "sAftTime = %02d%02d%02d%02d%02d%02d\n",                 //sAftTime    
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],
                    //sBefTime
                    pDataUser->sBefTime.YY,
                    pDataUser->sBefTime.MM,
                    pDataUser->sBefTime.DD,    
                    pDataUser->sBefTime.hh,
                    pDataUser->sBefTime.mm,
                    pDataUser->sBefTime.ss,
                    //sAftTime
                    pDataUser->sAftTime.YY,
                    pDataUser->sAftTime.MM,
                    pDataUser->sAftTime.DD,    
                    pDataUser->sAftTime.hh,
                    pDataUser->sAftTime.mm,
                    pDataUser->sAftTime.ss);
        }
        #endif
    }

    return E_CJT188_OK;
}


/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_less_more_loss_elec
 功能描述  : 用户侧和帧侧转换，过流，失流，断流事件信息结构
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月23日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_less_more_loss_elec(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    INT32 nLenBCD =  115;
    INT32 nOutBCDLen =  230;
    INT32 i = 0;
    char strUsr[300] = {0};
    char strBcd[300] = {0};
    S_CJT188_LESS_MORE_LOSS_ELET *pDataUser = NULL;
    #ifdef CJT188_DEBUG_ON
    S_CJT188_LESS_MORE_LOSS_ELET sTest ;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_LESS_MORE_LOSS_ELET *)user;    
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {    
            pDataUser = (S_CJT188_LESS_MORE_LOSS_ELET*)&sTest;
            
            sTest.sBgnTime.YY = 0x07;
            sTest.sBgnTime.MM = 0x07;
            sTest.sBgnTime.DD = 0x07;
            sTest.sBgnTime.hh = 0x07;
            sTest.sBgnTime.mm = 0x07;
            sTest.sBgnTime.ss = 0x07;
            
            sTest.sEndTime.YY = 0x08;
            sTest.sEndTime.MM = 0x08;
            sTest.sEndTime.DD = 0x08;
            sTest.sEndTime.hh = 0x08;
            sTest.sEndTime.mm = 0x08;
            sTest.sEndTime.ss = 0x08;
            
            //sPowerTotal
            sTest.sPowerTotal.dForthHavePowerIcr = 123456.78;
            sTest.sPowerTotal.dBackHavePowerIcr  = 123456.78;
            sTest.sPowerTotal.dCombNone1PowerIcr = 123456.78;
            sTest.sPowerTotal.dCombNone2PowerIcr = 123456.78;
            //sPowerA
            sTest.sPowerA.dForthHavePowerIcr = 123456.78;
            sTest.sPowerA.dBackHavePowerIcr = 123456.78;
            sTest.sPowerA.dCombNone1PowerIcr = 123456.78;
            sTest.sPowerA.dCombNone2PowerIcr = 123456.78;
            //sFactorA
            sTest.sFactorA.fVolt = 123.4;
            sTest.sFactorA.fElec= 123.456;
            sTest.sFactorA.fHavePowerRate = 12.3456;
            sTest.sFactorA.fNonePowerRate= 12.3456;
            sTest.sFactorA.fPowerRateFactor = 1.234;
            //sPowerB
            sTest.sPowerB.dForthHavePowerIcr= 123456.78;
            sTest.sPowerB.dBackHavePowerIcr= 123456.78;
            sTest.sPowerB.dCombNone1PowerIcr= 123456.78;
            sTest.sPowerB.dCombNone2PowerIcr= 123456.78;
            //sFactorB
            sTest.sFactorB.fVolt = 123.4;
            sTest.sFactorB.fElec= 123.456;
            sTest.sFactorB.fHavePowerRate = 12.3456;
            sTest.sFactorB.fNonePowerRate= 12.3456;
            sTest.sFactorB.fPowerRateFactor = 1.234;
            //sPowerC
            sTest.sPowerC.dForthHavePowerIcr= 123456.78;
            sTest.sPowerC.dBackHavePowerIcr= 123456.78;
            sTest.sPowerC.dCombNone1PowerIcr= 123456.78;
            sTest.sPowerC.dCombNone2PowerIcr= 123456.78;
            //sFactorC
            sTest.sFactorC.fVolt = 123.4;
            sTest.sFactorC.fElec= 123.456;
            sTest.sFactorC.fHavePowerRate = 12.3456;
            sTest.sFactorC.fNonePowerRate= 12.3456;
            sTest.sFactorC.fPowerRateFactor = 1.234;

        }
        #endif
        
        /* start time  字节总长 297*/
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"         //sBgnTime
                        "%02d%02d%02d%02d%02d%02d"        //end time
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerTotal
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerA
                        "%05.1f%07.3f%07.4f%07.4f%05.3f"//sFactorA
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerB
                        "%05.1f%07.3f%07.4f%07.4f%05.3f"//sFactorB
                        "%09.2f%09.2f%09.2f%09.2f"        //sPowerC
                        "%05.1f%07.3f%07.4f%07.4f%05.3f",//sFactorC
                        //sBgnTime
                        pDataUser->sBgnTime.YY,
                        pDataUser->sBgnTime.MM,
                        pDataUser->sBgnTime.DD,    
                        pDataUser->sBgnTime.hh,
                        pDataUser->sBgnTime.mm,
                        pDataUser->sBgnTime.ss,
                        //sEndTime
                        pDataUser->sEndTime.YY,
                        pDataUser->sEndTime.MM,
                        pDataUser->sEndTime.DD,    
                        pDataUser->sEndTime.hh,
                        pDataUser->sEndTime.mm,
                        pDataUser->sEndTime.ss,
                        //sPowerTotal
                        pDataUser->sPowerTotal.dForthHavePowerIcr,
                        pDataUser->sPowerTotal.dBackHavePowerIcr,
                        pDataUser->sPowerTotal.dCombNone1PowerIcr,
                        pDataUser->sPowerTotal.dCombNone2PowerIcr,
                        //sPowerA
                        pDataUser->sPowerA.dForthHavePowerIcr,
                        pDataUser->sPowerA.dBackHavePowerIcr,
                        pDataUser->sPowerA.dCombNone1PowerIcr,
                        pDataUser->sPowerA.dCombNone2PowerIcr,
                        //sFactorA
                        pDataUser->sFactorA.fVolt,
                        pDataUser->sFactorA.fElec,
                        pDataUser->sFactorA.fHavePowerRate,
                        pDataUser->sFactorA.fNonePowerRate,
                        pDataUser->sFactorA.fPowerRateFactor,
                        //sPowerB
                        pDataUser->sPowerB.dForthHavePowerIcr,
                        pDataUser->sPowerB.dBackHavePowerIcr,
                        pDataUser->sPowerB.dCombNone1PowerIcr,
                        pDataUser->sPowerB.dCombNone2PowerIcr,
                        //sFactorB
                        pDataUser->sFactorB.fVolt,
                        pDataUser->sFactorB.fElec,
                        pDataUser->sFactorB.fHavePowerRate,
                        pDataUser->sFactorB.fNonePowerRate,
                        pDataUser->sFactorB.fPowerRateFactor,
                        //sPowerA
                        pDataUser->sPowerC.dForthHavePowerIcr,
                        pDataUser->sPowerC.dBackHavePowerIcr,
                        pDataUser->sPowerC.dCombNone1PowerIcr,
                        pDataUser->sPowerC.dCombNone2PowerIcr,
                        //sFactorA
                        pDataUser->sFactorC.fVolt,
                        pDataUser->sFactorC.fElec,
                        pDataUser->sFactorC.fHavePowerRate,
                        pDataUser->sFactorC.fNonePowerRate,
                        pDataUser->sFactorC.fPowerRateFactor);
        
        cjt188_remove_dot(nOutBCDLen, strUsr, strBcd);
        cjt188_str2bcd(strBcd, (UINT8*)frame, nOutBCDLen);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, nLenBCD);
        //sBgnTime
        pDataUser->sBgnTime.YY = cjt188_str_to_num(&strUsr[i], 2);
        pDataUser->sBgnTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sEndTime
        pDataUser->sEndTime.YY = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sPowerTotal
        pDataUser->sPowerTotal.dForthHavePowerIcr = cjt188_str_to_double(&strUsr[i+=2],8,6);
        pDataUser->sPowerTotal.dBackHavePowerIcr  = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerTotal.dCombNone1PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerTotal.dCombNone2PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPowerA
        pDataUser->sPowerA.dForthHavePowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dBackHavePowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dCombNone1PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerA.dCombNone2PowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sFactorA
        pDataUser->sFactorA.fVolt = cjt188_str_to_double(&strUsr[i+=8], 4, 3);
        pDataUser->sFactorA.fElec= cjt188_str_to_double(&strUsr[i+=4], 6, 3);
        pDataUser->sFactorA.fHavePowerRate = cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorA.fNonePowerRate= cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorA.fPowerRateFactor = cjt188_str_to_double(&strUsr[i+=6], 4, 1);
        //sPowerB
        pDataUser->sPowerB.dForthHavePowerIcr= cjt188_str_to_double(&strUsr[i+=4], 8, 6);
        pDataUser->sPowerB.dBackHavePowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dCombNone1PowerIcr= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerB.dCombNone2PowerIcr= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sFactorB
        pDataUser->sFactorB.fVolt = cjt188_str_to_double(&strUsr[i+=8], 4, 3);
        pDataUser->sFactorB.fElec= cjt188_str_to_double(&strUsr[i+=4], 6, 3);
        pDataUser->sFactorB.fHavePowerRate = cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorB.fNonePowerRate= cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorB.fPowerRateFactor = cjt188_str_to_double(&strUsr[i+=6], 4, 1);
        //sPowerc
        pDataUser->sPowerC.dForthHavePowerIcr= cjt188_str_to_double(&strUsr[i+=4], 8, 6);
        pDataUser->sPowerC.dBackHavePowerIcr = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dCombNone1PowerIcr= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerC.dCombNone2PowerIcr= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sFactorc
        pDataUser->sFactorC.fVolt = cjt188_str_to_double(&strUsr[i+=8], 4, 3);
        pDataUser->sFactorC.fElec= cjt188_str_to_double(&strUsr[i+=4], 6, 3);
        pDataUser->sFactorC.fHavePowerRate = cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorC.fNonePowerRate= cjt188_str_to_double(&strUsr[i+=6], 6, 2);
        pDataUser->sFactorC.fPowerRateFactor = cjt188_str_to_double(&strUsr[i+=6], 4, 1);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, "sBgnTime = %02d%02d%02d%02d%02d%02d\n"         //sBgnTime
                                    "sEndTime = %02d%02d%02d%02d%02d%02d\n"        //end time
                                    "sPowerTotal = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerTotal
                                    "sPowerA = %09.2f %09.2f %09.2f% 09.2f\n"        //sPowerA
                                    "sFactorA = %05.1f %07.3f %07.4f %07.4f %05.3f\n"//sFactorA
                                    "sPowerB = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerB
                                    "sFactorB = %05.1f %07.3f %07.4f %07.4f %05.3f\n"//sFactorB
                                    "sPowerC = %09.2f %09.2f %09.2f %09.2f\n"        //sPowerC
                                    "sFactorC = %05.1f %07.3f %07.4f %07.4f %05.3f\n",//sFactorC
                                    //sBgnTime
                                    pDataUser->sBgnTime.YY,
                                    pDataUser->sBgnTime.MM,
                                    pDataUser->sBgnTime.DD,    
                                    pDataUser->sBgnTime.hh,
                                    pDataUser->sBgnTime.mm,
                                    pDataUser->sBgnTime.ss,
                                    //sEndTime
                                    pDataUser->sEndTime.YY,
                                    pDataUser->sEndTime.MM,
                                    pDataUser->sEndTime.DD,    
                                    pDataUser->sEndTime.hh,
                                    pDataUser->sEndTime.mm,
                                    pDataUser->sEndTime.ss,
                                    //sPowerTotal
                                    pDataUser->sPowerTotal.dForthHavePowerIcr,
                                    pDataUser->sPowerTotal.dBackHavePowerIcr,
                                    pDataUser->sPowerTotal.dCombNone1PowerIcr,
                                    pDataUser->sPowerTotal.dCombNone2PowerIcr,
                                    //sPowerA
                                    pDataUser->sPowerA.dForthHavePowerIcr,
                                    pDataUser->sPowerA.dBackHavePowerIcr,
                                    pDataUser->sPowerA.dCombNone1PowerIcr,
                                    pDataUser->sPowerA.dCombNone2PowerIcr,
                                    //sFactorA
                                    pDataUser->sFactorA.fVolt,
                                    pDataUser->sFactorA.fElec,
                                    pDataUser->sFactorA.fHavePowerRate,
                                    pDataUser->sFactorA.fNonePowerRate,
                                    pDataUser->sFactorA.fPowerRateFactor,
                                    //sPowerB
                                    pDataUser->sPowerB.dForthHavePowerIcr,
                                    pDataUser->sPowerB.dBackHavePowerIcr,
                                    pDataUser->sPowerB.dCombNone1PowerIcr,
                                    pDataUser->sPowerB.dCombNone2PowerIcr,
                                    //sFactorB
                                    pDataUser->sFactorB.fVolt,
                                    pDataUser->sFactorB.fElec,
                                    pDataUser->sFactorB.fHavePowerRate,
                                    pDataUser->sFactorB.fNonePowerRate,
                                    pDataUser->sFactorB.fPowerRateFactor,
                                    //sPowerC
                                    pDataUser->sPowerC.dForthHavePowerIcr,
                                    pDataUser->sPowerC.dBackHavePowerIcr,
                                    pDataUser->sPowerC.dCombNone1PowerIcr,
                                    pDataUser->sPowerC.dCombNone2PowerIcr,
                                    //sFactorC
                                    pDataUser->sFactorC.fVolt,
                                    pDataUser->sFactorC.fElec,
                                    pDataUser->sFactorC.fHavePowerRate,
                                    pDataUser->sFactorC.fNonePowerRate,
                                    pDataUser->sFactorC.fPowerRateFactor);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_event_clear
 功能描述  : 事件清零记录结构转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月26日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_event_clear(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventClear *pDataUser = NULL;
    char strUsr[64] = {0};
    INT32 i = 0;
    
    #ifdef CJT188_DEBUG_ON
    S_CJT188_EventClear sTest ;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    pDataUser = (S_CJT188_EventClear *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            
            pDataUser = (S_CJT188_EventClear*)&sTest;
            //sOccurTime
            sTest.sOccurTime.YY = 0x07;
            sTest.sOccurTime.MM = 0x07;
            sTest.sOccurTime.DD = 0x07;
            sTest.sOccurTime.hh = 0x07;
            sTest.sOccurTime.mm = 0x07;
            sTest.sOccurTime.ss = 0x07;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;
            //sTotal
            sTest.ulEventID =  0x12345678;
        }
        #endif
        
        /* start time  字节总长 297*/
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"                     //sOccurTime
                        "%02d%02d%02d%02d"                            //operator
                        //ulEventID
                        "%08X",                
                        //sBgnTime
                        pDataUser->sOccurTime.YY,
                        pDataUser->sOccurTime.MM,
                        pDataUser->sOccurTime.DD,    
                        pDataUser->sOccurTime.hh,
                        pDataUser->sOccurTime.mm,
                        pDataUser->sOccurTime.ss,
                        //operator
                        pDataUser->operator[0],
                        pDataUser->operator[1],
                        pDataUser->operator[2],
                        pDataUser->operator[3],
                        //sTotal
                        (UINT32)pDataUser->ulEventID);
        
        cjt188_str2bcd(strUsr, (UINT8*)frame, 28);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, 14);

        //sOccurTime
        pDataUser->sOccurTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sOccurTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //operator
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        //ulEventID
        pDataUser->ulEventID = cjt188_hex_str_to_long(&strUsr[i+=2], 8);
        

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "OccurTime = %02d%02d%02d%02d%02d%02d\n" //sOccurTime
                    "operator %02d%02d%02d%02d\n"             //operator
                    //sTotal
                    "sTotal = 0x%08X\n",    
                    //sOccurTime
                    pDataUser->sOccurTime.YY,
                    pDataUser->sOccurTime.MM,
                    pDataUser->sOccurTime.DD,    
                    pDataUser->sOccurTime.hh,
                    pDataUser->sOccurTime.mm,
                    pDataUser->sOccurTime.ss,
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],
                    //sTotal
                    pDataUser->ulEventID);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_demand_clear
 功能描述  : 最在需量清零事件记录转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月26日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/

eCJT188Err trans_cjt188_data_recd_demand_clear(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
#if 0

    S_CJT188_EventDemandClear *pDataUser = NULL;
    char strUsr[512] = {0};
    char strBcd[512] = {0};
    INT32 i = 0;
    #ifdef CJT188_DEBUG_ON
    S_CJT188_EventDemandClear sTest ;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventDemandClear *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
        
            pDataUser = (S_CJT188_EventDemandClear*)&sTest;
            //sOccurTime
            sTest.sOccurTime.YY = 0x07;
            sTest.sOccurTime.MM = 0x07;
            sTest.sOccurTime.DD = 0x07;
            sTest.sOccurTime.hh = 0x07;
            sTest.sOccurTime.mm = 0x07;
            sTest.sOccurTime.ss = 0x07;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;
            //sTotal
            sTest.sTotal.sFortHaveDemand.fXX_XXXX = 12.3456;
            sTest.sTotal.sFortHaveDemand.YY = 01;
            sTest.sTotal.sFortHaveDemand.MM = 01;
            sTest.sTotal.sFortHaveDemand.DD = 01;
            sTest.sTotal.sFortHaveDemand.hh = 01;
            sTest.sTotal.sFortHaveDemand.mm = 01;
            sTest.sTotal.sBackHaveDemand.fXX_XXXX = 12.3456;
            sTest.sTotal.sBackHaveDemand.YY = 01;
            sTest.sTotal.sBackHaveDemand.MM = 01;
            sTest.sTotal.sBackHaveDemand.DD = 01;
            sTest.sTotal.sBackHaveDemand.hh = 01;
            sTest.sTotal.sBackHaveDemand.mm = 01;
            sTest.sTotal.sNoneDemandQuad1.fXX_XXXX = 12.3456;
            sTest.sTotal.sNoneDemandQuad1.YY = 01;
            sTest.sTotal.sNoneDemandQuad1.MM = 01;
            sTest.sTotal.sNoneDemandQuad1.DD = 01;
            sTest.sTotal.sNoneDemandQuad1.hh = 01;
            sTest.sTotal.sNoneDemandQuad1.mm = 01;
            sTest.sTotal.sNoneDemandQuad2.fXX_XXXX = 12.3456;
            sTest.sTotal.sNoneDemandQuad2.YY = 01;
            sTest.sTotal.sNoneDemandQuad2.MM = 01;
            sTest.sTotal.sNoneDemandQuad2.DD = 01;
            sTest.sTotal.sNoneDemandQuad2.hh = 01;
            sTest.sTotal.sNoneDemandQuad2.mm = 01;
            sTest.sTotal.sNoneDemandQuad3.fXX_XXXX = 12.3456;
            sTest.sTotal.sNoneDemandQuad3.YY = 01;
            sTest.sTotal.sNoneDemandQuad3.MM = 01;
            sTest.sTotal.sNoneDemandQuad3.DD = 01;
            sTest.sTotal.sNoneDemandQuad3.hh = 01;
            sTest.sTotal.sNoneDemandQuad3.mm = 01;
            sTest.sTotal.sNoneDemandQuad4.fXX_XXXX = 12.3456;
            sTest.sTotal.sNoneDemandQuad4.YY = 01;
            sTest.sTotal.sNoneDemandQuad4.MM = 01;
            sTest.sTotal.sNoneDemandQuad4.DD = 01;
            sTest.sTotal.sNoneDemandQuad4.hh = 01;
            sTest.sTotal.sNoneDemandQuad4.mm = 01;
            //sPhaseA
            sTest.sPhaseA.sFortHaveDemand.fXX_XXXX = 12.3456;
            sTest.sPhaseA.sFortHaveDemand.YY = 02;
            sTest.sPhaseA.sFortHaveDemand.MM = 02;
            sTest.sPhaseA.sFortHaveDemand.DD = 02;
            sTest.sPhaseA.sFortHaveDemand.hh = 02;
            sTest.sPhaseA.sFortHaveDemand.mm = 02;
            sTest.sPhaseA.sBackHaveDemand.fXX_XXXX = 12.3456;
            sTest.sPhaseA.sBackHaveDemand.YY = 02;
            sTest.sPhaseA.sBackHaveDemand.MM = 02;
            sTest.sPhaseA.sBackHaveDemand.DD = 02;
            sTest.sPhaseA.sBackHaveDemand.hh = 02;
            sTest.sPhaseA.sBackHaveDemand.mm = 02;
            sTest.sPhaseA.sNoneDemandQuad1.fXX_XXXX = 12.3456;
            sTest.sPhaseA.sNoneDemandQuad1.YY = 02;
            sTest.sPhaseA.sNoneDemandQuad1.MM = 02;
            sTest.sPhaseA.sNoneDemandQuad1.DD = 02;
            sTest.sPhaseA.sNoneDemandQuad1.hh = 02;
            sTest.sPhaseA.sNoneDemandQuad1.mm = 02;
            sTest.sPhaseA.sNoneDemandQuad2.fXX_XXXX = 12.3456;
            sTest.sPhaseA.sNoneDemandQuad2.YY = 02;
            sTest.sPhaseA.sNoneDemandQuad2.MM = 02;
            sTest.sPhaseA.sNoneDemandQuad2.DD = 02;
            sTest.sPhaseA.sNoneDemandQuad2.hh = 02;
            sTest.sPhaseA.sNoneDemandQuad2.mm = 02;
            sTest.sPhaseA.sNoneDemandQuad3.fXX_XXXX = 12.3456;
            sTest.sPhaseA.sNoneDemandQuad3.YY = 02;
            sTest.sPhaseA.sNoneDemandQuad3.MM = 02;
            sTest.sPhaseA.sNoneDemandQuad3.DD = 02;
            sTest.sPhaseA.sNoneDemandQuad3.hh = 02;
            sTest.sPhaseA.sNoneDemandQuad3.mm = 02;
            sTest.sPhaseA.sNoneDemandQuad4.fXX_XXXX = 12.3456;
            sTest.sPhaseA.sNoneDemandQuad4.YY = 02;
            sTest.sPhaseA.sNoneDemandQuad4.MM = 02;
            sTest.sPhaseA.sNoneDemandQuad4.DD = 02;
            sTest.sPhaseA.sNoneDemandQuad4.hh = 02;
            sTest.sPhaseA.sNoneDemandQuad4.mm = 02;
            //sPhaseB
            sTest.sPhaseB.sFortHaveDemand.fXX_XXXX = 12.3456;
            sTest.sPhaseB.sFortHaveDemand.YY = 03;
            sTest.sPhaseB.sFortHaveDemand.MM = 03;
            sTest.sPhaseB.sFortHaveDemand.DD = 03;
            sTest.sPhaseB.sFortHaveDemand.hh = 03;
            sTest.sPhaseB.sFortHaveDemand.mm = 03;
            sTest.sPhaseB.sBackHaveDemand.fXX_XXXX = 12.3456;
            sTest.sPhaseB.sBackHaveDemand.YY = 03;
            sTest.sPhaseB.sBackHaveDemand.MM = 03;
            sTest.sPhaseB.sBackHaveDemand.DD = 03;
            sTest.sPhaseB.sBackHaveDemand.hh = 03;
            sTest.sPhaseB.sBackHaveDemand.mm = 03;
            sTest.sPhaseB.sNoneDemandQuad1.fXX_XXXX = 12.3456;
            sTest.sPhaseB.sNoneDemandQuad1.YY = 03;
            sTest.sPhaseB.sNoneDemandQuad1.MM = 03;
            sTest.sPhaseB.sNoneDemandQuad1.DD = 03;
            sTest.sPhaseB.sNoneDemandQuad1.hh = 03;
            sTest.sPhaseB.sNoneDemandQuad1.mm = 03;
            sTest.sPhaseB.sNoneDemandQuad2.fXX_XXXX = 12.3456;
            sTest.sPhaseB.sNoneDemandQuad2.YY = 03;
            sTest.sPhaseB.sNoneDemandQuad2.MM = 03;
            sTest.sPhaseB.sNoneDemandQuad2.DD = 03;
            sTest.sPhaseB.sNoneDemandQuad2.hh = 03;
            sTest.sPhaseB.sNoneDemandQuad2.mm = 03;
            sTest.sPhaseB.sNoneDemandQuad3.fXX_XXXX = 12.3456;
            sTest.sPhaseB.sNoneDemandQuad3.YY = 03;
            sTest.sPhaseB.sNoneDemandQuad3.MM = 03;
            sTest.sPhaseB.sNoneDemandQuad3.DD = 03;
            sTest.sPhaseB.sNoneDemandQuad3.hh = 03;
            sTest.sPhaseB.sNoneDemandQuad3.mm = 03;
            sTest.sPhaseB.sNoneDemandQuad4.fXX_XXXX = 12.3456;
            sTest.sPhaseB.sNoneDemandQuad4.YY = 03;
            sTest.sPhaseB.sNoneDemandQuad4.MM = 03;
            sTest.sPhaseB.sNoneDemandQuad4.DD = 03;
            sTest.sPhaseB.sNoneDemandQuad4.hh = 03;
            sTest.sPhaseB.sNoneDemandQuad4.mm = 03;
            //sPhaseC
            sTest.sPhaseC.sFortHaveDemand.fXX_XXXX = 12.3456;
            sTest.sPhaseC.sFortHaveDemand.YY = 04;
            sTest.sPhaseC.sFortHaveDemand.MM = 04;
            sTest.sPhaseC.sFortHaveDemand.DD = 04;
            sTest.sPhaseC.sFortHaveDemand.hh = 04;
            sTest.sPhaseC.sFortHaveDemand.mm = 04;
            sTest.sPhaseC.sBackHaveDemand.fXX_XXXX = 12.3456;
            sTest.sPhaseC.sBackHaveDemand.YY = 04;
            sTest.sPhaseC.sBackHaveDemand.MM = 04;
            sTest.sPhaseC.sBackHaveDemand.DD = 04;
            sTest.sPhaseC.sBackHaveDemand.hh = 04;
            sTest.sPhaseC.sBackHaveDemand.mm = 04;
            sTest.sPhaseC.sNoneDemandQuad1.fXX_XXXX = 12.3456;
            sTest.sPhaseC.sNoneDemandQuad1.YY = 04;
            sTest.sPhaseC.sNoneDemandQuad1.MM = 04;
            sTest.sPhaseC.sNoneDemandQuad1.DD = 04;
            sTest.sPhaseC.sNoneDemandQuad1.hh = 04;
            sTest.sPhaseC.sNoneDemandQuad1.mm = 04;
            sTest.sPhaseC.sNoneDemandQuad2.fXX_XXXX = 12.3456;
            sTest.sPhaseC.sNoneDemandQuad2.YY = 04;
            sTest.sPhaseC.sNoneDemandQuad2.MM = 04;
            sTest.sPhaseC.sNoneDemandQuad2.DD = 04;
            sTest.sPhaseC.sNoneDemandQuad2.hh = 04;
            sTest.sPhaseC.sNoneDemandQuad2.mm = 04;
            sTest.sPhaseC.sNoneDemandQuad3.fXX_XXXX = 12.3456;
            sTest.sPhaseC.sNoneDemandQuad3.YY = 04;
            sTest.sPhaseC.sNoneDemandQuad3.MM = 04;
            sTest.sPhaseC.sNoneDemandQuad3.DD = 04;
            sTest.sPhaseC.sNoneDemandQuad3.hh = 04;
            sTest.sPhaseC.sNoneDemandQuad3.mm = 04;
            sTest.sPhaseC.sNoneDemandQuad4.fXX_XXXX = 12.3456;
            sTest.sPhaseC.sNoneDemandQuad4.YY = 04;
            sTest.sPhaseC.sNoneDemandQuad4.MM = 04;
            sTest.sPhaseC.sNoneDemandQuad4.DD = 04;
            sTest.sPhaseC.sNoneDemandQuad4.hh = 04;
            sTest.sPhaseC.sNoneDemandQuad4.mm = 04;

        }
        #endif
        
        /* start time  字节总长 297*/
        snprintf(strUsr, sizeof(strUsr), 
                        "%02d%02d%02d%02d%02d%02d"                     //sOccurTime
                        "%02d%02d%02d%02d"                            //operator
                        //sTotal
                        "%06.4f%02d%02d%02d%02d%02d"    
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        //sPhaseA
                        "%06.4f%02d%02d%02d%02d%02d"    
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        //sTotal
                        "%06.4f%02d%02d%02d%02d%02d"    
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        //sPhaseA
                        "%06.4f%02d%02d%02d%02d%02d"    
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d"
                        "%06.4f%02d%02d%02d%02d%02d",                
                        //sBgnTime
                        pDataUser->sOccurTime.YY,
                        pDataUser->sOccurTime.MM,
                        pDataUser->sOccurTime.DD,    
                        pDataUser->sOccurTime.hh,
                        pDataUser->sOccurTime.mm,
                        pDataUser->sOccurTime.ss,
                        //operator
                        pDataUser->operator[0],
                        pDataUser->operator[1],
                        pDataUser->operator[2],
                        pDataUser->operator[3],
                        //sTotal
                        pDataUser->sTotal.sFortHaveDemand.fXX_XXXX,
                        pDataUser->sTotal.sFortHaveDemand.YY,
                        pDataUser->sTotal.sFortHaveDemand.MM,
                        pDataUser->sTotal.sFortHaveDemand.DD,
                        pDataUser->sTotal.sFortHaveDemand.hh,
                        pDataUser->sTotal.sFortHaveDemand.mm,
                        pDataUser->sTotal.sBackHaveDemand.fXX_XXXX,
                        pDataUser->sTotal.sBackHaveDemand.YY,
                        pDataUser->sTotal.sBackHaveDemand.MM,
                        pDataUser->sTotal.sBackHaveDemand.DD,
                        pDataUser->sTotal.sBackHaveDemand.hh,
                        pDataUser->sTotal.sBackHaveDemand.mm,
                        pDataUser->sTotal.sNoneDemandQuad1.fXX_XXXX,
                        pDataUser->sTotal.sNoneDemandQuad1.YY,
                        pDataUser->sTotal.sNoneDemandQuad1.MM,
                        pDataUser->sTotal.sNoneDemandQuad1.DD,
                        pDataUser->sTotal.sNoneDemandQuad1.hh,
                        pDataUser->sTotal.sNoneDemandQuad1.mm,
                        pDataUser->sTotal.sNoneDemandQuad2.fXX_XXXX,
                        pDataUser->sTotal.sNoneDemandQuad2.YY,
                        pDataUser->sTotal.sNoneDemandQuad2.MM,
                        pDataUser->sTotal.sNoneDemandQuad2.DD,
                        pDataUser->sTotal.sNoneDemandQuad2.hh,
                        pDataUser->sTotal.sNoneDemandQuad2.mm,
                        pDataUser->sTotal.sNoneDemandQuad3.fXX_XXXX,
                        pDataUser->sTotal.sNoneDemandQuad3.YY,
                        pDataUser->sTotal.sNoneDemandQuad3.MM,
                        pDataUser->sTotal.sNoneDemandQuad3.DD,
                        pDataUser->sTotal.sNoneDemandQuad3.hh,
                        pDataUser->sTotal.sNoneDemandQuad3.mm,
                        pDataUser->sTotal.sNoneDemandQuad4.fXX_XXXX,
                        pDataUser->sTotal.sNoneDemandQuad4.YY,
                        pDataUser->sTotal.sNoneDemandQuad4.MM,
                        pDataUser->sTotal.sNoneDemandQuad4.DD,
                        pDataUser->sTotal.sNoneDemandQuad4.hh,
                        pDataUser->sTotal.sNoneDemandQuad4.mm,
                        //sPhaseA
                        pDataUser->sPhaseA.sFortHaveDemand.fXX_XXXX,
                        pDataUser->sPhaseA.sFortHaveDemand.YY,
                        pDataUser->sPhaseA.sFortHaveDemand.MM,
                        pDataUser->sPhaseA.sFortHaveDemand.DD,
                        pDataUser->sPhaseA.sFortHaveDemand.hh,
                        pDataUser->sPhaseA.sFortHaveDemand.mm,
                        pDataUser->sPhaseA.sBackHaveDemand.fXX_XXXX,
                        pDataUser->sPhaseA.sBackHaveDemand.YY,
                        pDataUser->sPhaseA.sBackHaveDemand.MM,
                        pDataUser->sPhaseA.sBackHaveDemand.DD,
                        pDataUser->sPhaseA.sBackHaveDemand.hh,
                        pDataUser->sPhaseA.sBackHaveDemand.mm,
                        pDataUser->sPhaseA.sNoneDemandQuad1.fXX_XXXX,
                        pDataUser->sPhaseA.sNoneDemandQuad1.YY,
                        pDataUser->sPhaseA.sNoneDemandQuad1.MM,
                        pDataUser->sPhaseA.sNoneDemandQuad1.DD,
                        pDataUser->sPhaseA.sNoneDemandQuad1.hh,
                        pDataUser->sPhaseA.sNoneDemandQuad1.mm,
                        pDataUser->sPhaseA.sNoneDemandQuad2.fXX_XXXX,
                        pDataUser->sPhaseA.sNoneDemandQuad2.YY,
                        pDataUser->sPhaseA.sNoneDemandQuad2.MM,
                        pDataUser->sPhaseA.sNoneDemandQuad2.DD,
                        pDataUser->sPhaseA.sNoneDemandQuad2.hh,
                        pDataUser->sPhaseA.sNoneDemandQuad2.mm,
                        pDataUser->sPhaseA.sNoneDemandQuad3.fXX_XXXX,
                        pDataUser->sPhaseA.sNoneDemandQuad3.YY,
                        pDataUser->sPhaseA.sNoneDemandQuad3.MM,
                        pDataUser->sPhaseA.sNoneDemandQuad3.DD,
                        pDataUser->sPhaseA.sNoneDemandQuad3.hh,
                        pDataUser->sPhaseA.sNoneDemandQuad3.mm,
                        pDataUser->sPhaseA.sNoneDemandQuad4.fXX_XXXX,
                        pDataUser->sPhaseA.sNoneDemandQuad4.YY,
                        pDataUser->sPhaseA.sNoneDemandQuad4.MM,
                        pDataUser->sPhaseA.sNoneDemandQuad4.DD,
                        pDataUser->sPhaseA.sNoneDemandQuad4.hh,
                        pDataUser->sPhaseA.sNoneDemandQuad4.mm,
                        //sPhaseB
                        pDataUser->sPhaseB.sFortHaveDemand.fXX_XXXX,
                        pDataUser->sPhaseB.sFortHaveDemand.YY ,
                        pDataUser->sPhaseB.sFortHaveDemand.MM ,
                        pDataUser->sPhaseB.sFortHaveDemand.DD ,
                        pDataUser->sPhaseB.sFortHaveDemand.hh ,
                        pDataUser->sPhaseB.sFortHaveDemand.mm ,
                        pDataUser->sPhaseB.sBackHaveDemand.fXX_XXXX,
                        pDataUser->sPhaseB.sBackHaveDemand.YY ,
                        pDataUser->sPhaseB.sBackHaveDemand.MM ,
                        pDataUser->sPhaseB.sBackHaveDemand.DD ,
                        pDataUser->sPhaseB.sBackHaveDemand.hh ,
                        pDataUser->sPhaseB.sBackHaveDemand.mm ,
                        pDataUser->sPhaseB.sNoneDemandQuad1.fXX_XXXX,
                        pDataUser->sPhaseB.sNoneDemandQuad1.YY ,
                        pDataUser->sPhaseB.sNoneDemandQuad1.MM ,
                        pDataUser->sPhaseB.sNoneDemandQuad1.DD ,
                        pDataUser->sPhaseB.sNoneDemandQuad1.hh ,
                        pDataUser->sPhaseB.sNoneDemandQuad1.mm ,
                        pDataUser->sPhaseB.sNoneDemandQuad2.fXX_XXXX,
                        pDataUser->sPhaseB.sNoneDemandQuad2.YY ,
                        pDataUser->sPhaseB.sNoneDemandQuad2.MM ,
                        pDataUser->sPhaseB.sNoneDemandQuad2.DD ,
                        pDataUser->sPhaseB.sNoneDemandQuad2.hh ,
                        pDataUser->sPhaseB.sNoneDemandQuad2.mm ,
                        pDataUser->sPhaseB.sNoneDemandQuad3.fXX_XXXX,
                        pDataUser->sPhaseB.sNoneDemandQuad3.YY ,
                        pDataUser->sPhaseB.sNoneDemandQuad3.MM ,
                        pDataUser->sPhaseB.sNoneDemandQuad3.DD ,
                        pDataUser->sPhaseB.sNoneDemandQuad3.hh ,
                        pDataUser->sPhaseB.sNoneDemandQuad3.mm ,
                        pDataUser->sPhaseB.sNoneDemandQuad4.fXX_XXXX,
                        pDataUser->sPhaseB.sNoneDemandQuad4.YY ,
                        pDataUser->sPhaseB.sNoneDemandQuad4.MM ,
                        pDataUser->sPhaseB.sNoneDemandQuad4.DD ,
                        pDataUser->sPhaseB.sNoneDemandQuad4.hh ,
                        pDataUser->sPhaseB.sNoneDemandQuad4.mm ,
                        //sPhaseC
                        pDataUser->sPhaseC.sFortHaveDemand.fXX_XXXX,
                        pDataUser->sPhaseC.sFortHaveDemand.YY,
                        pDataUser->sPhaseC.sFortHaveDemand.MM,
                        pDataUser->sPhaseC.sFortHaveDemand.DD,
                        pDataUser->sPhaseC.sFortHaveDemand.hh,
                        pDataUser->sPhaseC.sFortHaveDemand.mm,
                        pDataUser->sPhaseC.sBackHaveDemand.fXX_XXXX,
                        pDataUser->sPhaseC.sBackHaveDemand.YY,
                        pDataUser->sPhaseC.sBackHaveDemand.MM,
                        pDataUser->sPhaseC.sBackHaveDemand.DD,
                        pDataUser->sPhaseC.sBackHaveDemand.hh,
                        pDataUser->sPhaseC.sBackHaveDemand.mm,
                        pDataUser->sPhaseC.sNoneDemandQuad1.fXX_XXXX,
                        pDataUser->sPhaseC.sNoneDemandQuad1.YY,
                        pDataUser->sPhaseC.sNoneDemandQuad1.MM,
                        pDataUser->sPhaseC.sNoneDemandQuad1.DD,
                        pDataUser->sPhaseC.sNoneDemandQuad1.hh,
                        pDataUser->sPhaseC.sNoneDemandQuad1.mm,
                        pDataUser->sPhaseC.sNoneDemandQuad2.fXX_XXXX,
                        pDataUser->sPhaseC.sNoneDemandQuad2.YY,
                        pDataUser->sPhaseC.sNoneDemandQuad2.MM,
                        pDataUser->sPhaseC.sNoneDemandQuad2.DD,
                        pDataUser->sPhaseC.sNoneDemandQuad2.hh,
                        pDataUser->sPhaseC.sNoneDemandQuad2.mm,
                        pDataUser->sPhaseC.sNoneDemandQuad3.fXX_XXXX,
                        pDataUser->sPhaseC.sNoneDemandQuad3.YY,
                        pDataUser->sPhaseC.sNoneDemandQuad3.MM,
                        pDataUser->sPhaseC.sNoneDemandQuad3.DD,
                        pDataUser->sPhaseC.sNoneDemandQuad3.hh,
                        pDataUser->sPhaseC.sNoneDemandQuad3.mm,
                        pDataUser->sPhaseC.sNoneDemandQuad4.fXX_XXXX,
                        pDataUser->sPhaseC.sNoneDemandQuad4.YY,
                        pDataUser->sPhaseC.sNoneDemandQuad4.MM,
                        pDataUser->sPhaseC.sNoneDemandQuad4.DD,
                        pDataUser->sPhaseC.sNoneDemandQuad4.hh,
                        pDataUser->sPhaseC.sNoneDemandQuad4.mm);
        
        cjt188_remove_dot(CJT188_DATA_LEN_RECD_DEAMD_CLEAR  * 2,strUsr, strBcd);
        cjt188_str2bcd(strBcd, (UINT8*)frame, CJT188_DATA_LEN_RECD_DEAMD_CLEAR *2);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, CJT188_DATA_LEN_RECD_DEAMD_CLEAR);

        //sOccurTime
        pDataUser->sOccurTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sOccurTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //operator
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sTotal
        pDataUser->sTotal.sFortHaveDemand.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sTotal.sFortHaveDemand.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sTotal.sFortHaveDemand.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sFortHaveDemand.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sFortHaveDemand.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sFortHaveDemand.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sBackHaveDemand.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sTotal.sBackHaveDemand.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sTotal.sBackHaveDemand.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sBackHaveDemand.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sBackHaveDemand.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sBackHaveDemand.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad1.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sTotal.sNoneDemandQuad1.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sTotal.sNoneDemandQuad1.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad1.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad1.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad1.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad2.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sTotal.sNoneDemandQuad2.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sTotal.sNoneDemandQuad2.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad2.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad2.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad2.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad3.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sTotal.sNoneDemandQuad3.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sTotal.sNoneDemandQuad3.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad3.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad3.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad3.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad4.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sTotal.sNoneDemandQuad4.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sTotal.sNoneDemandQuad4.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad4.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad4.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTotal.sNoneDemandQuad4.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sPhaseA
        pDataUser->sPhaseA.sFortHaveDemand.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseA.sFortHaveDemand.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseA.sFortHaveDemand.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sFortHaveDemand.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sFortHaveDemand.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sFortHaveDemand.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sBackHaveDemand.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseA.sBackHaveDemand.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseA.sBackHaveDemand.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sBackHaveDemand.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sBackHaveDemand.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sBackHaveDemand.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad1.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseA.sNoneDemandQuad1.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseA.sNoneDemandQuad1.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad1.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad1.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad1.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad2.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseA.sNoneDemandQuad2.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseA.sNoneDemandQuad2.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad2.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad2.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad2.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad3.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseA.sNoneDemandQuad3.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseA.sNoneDemandQuad3.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad3.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad3.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad3.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad4.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseA.sNoneDemandQuad4.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseA.sNoneDemandQuad4.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad4.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad4.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseA.sNoneDemandQuad4.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sPhaseB
        pDataUser->sPhaseB.sFortHaveDemand.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseB.sFortHaveDemand.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseB.sFortHaveDemand.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sFortHaveDemand.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sFortHaveDemand.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sFortHaveDemand.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sBackHaveDemand.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseB.sBackHaveDemand.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseB.sBackHaveDemand.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sBackHaveDemand.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sBackHaveDemand.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sBackHaveDemand.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad1.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseB.sNoneDemandQuad1.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseB.sNoneDemandQuad1.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad1.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad1.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad1.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad2.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseB.sNoneDemandQuad2.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseB.sNoneDemandQuad2.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad2.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad2.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad2.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad3.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseB.sNoneDemandQuad3.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseB.sNoneDemandQuad3.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad3.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad3.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad3.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad4.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseB.sNoneDemandQuad4.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseB.sNoneDemandQuad4.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad4.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad4.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseB.sNoneDemandQuad4.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sPhaseC
        pDataUser->sPhaseC.sFortHaveDemand.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseC.sFortHaveDemand.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseC.sFortHaveDemand.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sFortHaveDemand.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sFortHaveDemand.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sFortHaveDemand.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sBackHaveDemand.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseC.sBackHaveDemand.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseC.sBackHaveDemand.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sBackHaveDemand.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sBackHaveDemand.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sBackHaveDemand.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad1.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseC.sNoneDemandQuad1.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseC.sNoneDemandQuad1.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad1.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad1.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad1.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad2.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseC.sNoneDemandQuad2.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseC.sNoneDemandQuad2.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad2.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad2.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad2.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad3.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseC.sNoneDemandQuad3.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseC.sNoneDemandQuad3.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad3.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad3.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad3.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad4.fXX_XXXX = cjt188_str_to_double(&strUsr[i+=2], 6, 2);
        pDataUser->sPhaseC.sNoneDemandQuad4.YY = cjt188_str_to_num(&strUsr[i+=6], 2);
        pDataUser->sPhaseC.sNoneDemandQuad4.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad4.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad4.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sPhaseC.sNoneDemandQuad4.mm = cjt188_str_to_num(&strUsr[i+=2], 2);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "OccurTime = %02d%02d%02d%02d%02d%02d\n" //sOccurTime
                    "operator %02d%02d%02d%02d\n"             //operator
                    //sTotal
                    "sTotal\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"    
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    //sPhaseA
                    "sPhaseA\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"    
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    //sPhaseB
                    "sPhaseB\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"    
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    //sPhaseC
                    "sPhaseC\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"    
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n"
                    "%06.4f %02d%02d%02d%02d%02d\n",                
                    //sOccurTime
                    pDataUser->sOccurTime.YY,
                    pDataUser->sOccurTime.MM,
                    pDataUser->sOccurTime.DD,    
                    pDataUser->sOccurTime.hh,
                    pDataUser->sOccurTime.mm,
                    pDataUser->sOccurTime.ss,
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],
                    //sTotal
                    pDataUser->sTotal.sFortHaveDemand.fXX_XXXX,
                    pDataUser->sTotal.sFortHaveDemand.YY,
                    pDataUser->sTotal.sFortHaveDemand.MM,
                    pDataUser->sTotal.sFortHaveDemand.DD,
                    pDataUser->sTotal.sFortHaveDemand.hh,
                    pDataUser->sTotal.sFortHaveDemand.mm,
                    pDataUser->sTotal.sBackHaveDemand.fXX_XXXX,
                    pDataUser->sTotal.sBackHaveDemand.YY,
                    pDataUser->sTotal.sBackHaveDemand.MM,
                    pDataUser->sTotal.sBackHaveDemand.DD,
                    pDataUser->sTotal.sBackHaveDemand.hh,
                    pDataUser->sTotal.sBackHaveDemand.mm,
                    pDataUser->sTotal.sNoneDemandQuad1.fXX_XXXX,
                    pDataUser->sTotal.sNoneDemandQuad1.YY,
                    pDataUser->sTotal.sNoneDemandQuad1.MM,
                    pDataUser->sTotal.sNoneDemandQuad1.DD,
                    pDataUser->sTotal.sNoneDemandQuad1.hh,
                    pDataUser->sTotal.sNoneDemandQuad1.mm,
                    pDataUser->sTotal.sNoneDemandQuad2.fXX_XXXX,
                    pDataUser->sTotal.sNoneDemandQuad2.YY,
                    pDataUser->sTotal.sNoneDemandQuad2.MM,
                    pDataUser->sTotal.sNoneDemandQuad2.DD,
                    pDataUser->sTotal.sNoneDemandQuad2.hh,
                    pDataUser->sTotal.sNoneDemandQuad2.mm,
                    pDataUser->sTotal.sNoneDemandQuad3.fXX_XXXX,
                    pDataUser->sTotal.sNoneDemandQuad3.YY,
                    pDataUser->sTotal.sNoneDemandQuad3.MM,
                    pDataUser->sTotal.sNoneDemandQuad3.DD,
                    pDataUser->sTotal.sNoneDemandQuad3.hh,
                    pDataUser->sTotal.sNoneDemandQuad3.mm,
                    pDataUser->sTotal.sNoneDemandQuad4.fXX_XXXX,
                    pDataUser->sTotal.sNoneDemandQuad4.YY,
                    pDataUser->sTotal.sNoneDemandQuad4.MM,
                    pDataUser->sTotal.sNoneDemandQuad4.DD,
                    pDataUser->sTotal.sNoneDemandQuad4.hh,
                    pDataUser->sTotal.sNoneDemandQuad4.mm,
                    //sPhaseA
                    pDataUser->sPhaseA.sFortHaveDemand.fXX_XXXX,
                    pDataUser->sPhaseA.sFortHaveDemand.YY,
                    pDataUser->sPhaseA.sFortHaveDemand.MM,
                    pDataUser->sPhaseA.sFortHaveDemand.DD,
                    pDataUser->sPhaseA.sFortHaveDemand.hh,
                    pDataUser->sPhaseA.sFortHaveDemand.mm,
                    pDataUser->sPhaseA.sBackHaveDemand.fXX_XXXX,
                    pDataUser->sPhaseA.sBackHaveDemand.YY,
                    pDataUser->sPhaseA.sBackHaveDemand.MM,
                    pDataUser->sPhaseA.sBackHaveDemand.DD,
                    pDataUser->sPhaseA.sBackHaveDemand.hh,
                    pDataUser->sPhaseA.sBackHaveDemand.mm,
                    pDataUser->sPhaseA.sNoneDemandQuad1.fXX_XXXX,
                    pDataUser->sPhaseA.sNoneDemandQuad1.YY,
                    pDataUser->sPhaseA.sNoneDemandQuad1.MM,
                    pDataUser->sPhaseA.sNoneDemandQuad1.DD,
                    pDataUser->sPhaseA.sNoneDemandQuad1.hh,
                    pDataUser->sPhaseA.sNoneDemandQuad1.mm,
                    pDataUser->sPhaseA.sNoneDemandQuad2.fXX_XXXX,
                    pDataUser->sPhaseA.sNoneDemandQuad2.YY,
                    pDataUser->sPhaseA.sNoneDemandQuad2.MM,
                    pDataUser->sPhaseA.sNoneDemandQuad2.DD,
                    pDataUser->sPhaseA.sNoneDemandQuad2.hh,
                    pDataUser->sPhaseA.sNoneDemandQuad2.mm,
                    pDataUser->sPhaseA.sNoneDemandQuad3.fXX_XXXX,
                    pDataUser->sPhaseA.sNoneDemandQuad3.YY,
                    pDataUser->sPhaseA.sNoneDemandQuad3.MM,
                    pDataUser->sPhaseA.sNoneDemandQuad3.DD,
                    pDataUser->sPhaseA.sNoneDemandQuad3.hh,
                    pDataUser->sPhaseA.sNoneDemandQuad3.mm,
                    pDataUser->sPhaseA.sNoneDemandQuad4.fXX_XXXX,
                    pDataUser->sPhaseA.sNoneDemandQuad4.YY,
                    pDataUser->sPhaseA.sNoneDemandQuad4.MM,
                    pDataUser->sPhaseA.sNoneDemandQuad4.DD,
                    pDataUser->sPhaseA.sNoneDemandQuad4.hh,
                    pDataUser->sPhaseA.sNoneDemandQuad4.mm,
                    //sPhaseB
                    pDataUser->sPhaseB.sFortHaveDemand.fXX_XXXX,
                    pDataUser->sPhaseB.sFortHaveDemand.YY ,
                    pDataUser->sPhaseB.sFortHaveDemand.MM ,
                    pDataUser->sPhaseB.sFortHaveDemand.DD ,
                    pDataUser->sPhaseB.sFortHaveDemand.hh ,
                    pDataUser->sPhaseB.sFortHaveDemand.mm ,
                    pDataUser->sPhaseB.sBackHaveDemand.fXX_XXXX,
                    pDataUser->sPhaseB.sBackHaveDemand.YY ,
                    pDataUser->sPhaseB.sBackHaveDemand.MM ,
                    pDataUser->sPhaseB.sBackHaveDemand.DD ,
                    pDataUser->sPhaseB.sBackHaveDemand.hh ,
                    pDataUser->sPhaseB.sBackHaveDemand.mm ,
                    pDataUser->sPhaseB.sNoneDemandQuad1.fXX_XXXX,
                    pDataUser->sPhaseB.sNoneDemandQuad1.YY ,
                    pDataUser->sPhaseB.sNoneDemandQuad1.MM ,
                    pDataUser->sPhaseB.sNoneDemandQuad1.DD ,
                    pDataUser->sPhaseB.sNoneDemandQuad1.hh ,
                    pDataUser->sPhaseB.sNoneDemandQuad1.mm ,
                    pDataUser->sPhaseB.sNoneDemandQuad2.fXX_XXXX,
                    pDataUser->sPhaseB.sNoneDemandQuad2.YY ,
                    pDataUser->sPhaseB.sNoneDemandQuad2.MM ,
                    pDataUser->sPhaseB.sNoneDemandQuad2.DD ,
                    pDataUser->sPhaseB.sNoneDemandQuad2.hh ,
                    pDataUser->sPhaseB.sNoneDemandQuad2.mm ,
                    pDataUser->sPhaseB.sNoneDemandQuad3.fXX_XXXX,
                    pDataUser->sPhaseB.sNoneDemandQuad3.YY ,
                    pDataUser->sPhaseB.sNoneDemandQuad3.MM ,
                    pDataUser->sPhaseB.sNoneDemandQuad3.DD ,
                    pDataUser->sPhaseB.sNoneDemandQuad3.hh ,
                    pDataUser->sPhaseB.sNoneDemandQuad3.mm ,
                    pDataUser->sPhaseB.sNoneDemandQuad4.fXX_XXXX,
                    pDataUser->sPhaseB.sNoneDemandQuad4.YY ,
                    pDataUser->sPhaseB.sNoneDemandQuad4.MM ,
                    pDataUser->sPhaseB.sNoneDemandQuad4.DD ,
                    pDataUser->sPhaseB.sNoneDemandQuad4.hh ,
                    pDataUser->sPhaseB.sNoneDemandQuad4.mm ,
                    //sPhaseC
                    pDataUser->sPhaseC.sFortHaveDemand.fXX_XXXX,
                    pDataUser->sPhaseC.sFortHaveDemand.YY,
                    pDataUser->sPhaseC.sFortHaveDemand.MM,
                    pDataUser->sPhaseC.sFortHaveDemand.DD,
                    pDataUser->sPhaseC.sFortHaveDemand.hh,
                    pDataUser->sPhaseC.sFortHaveDemand.mm,
                    pDataUser->sPhaseC.sBackHaveDemand.fXX_XXXX,
                    pDataUser->sPhaseC.sBackHaveDemand.YY,
                    pDataUser->sPhaseC.sBackHaveDemand.MM,
                    pDataUser->sPhaseC.sBackHaveDemand.DD,
                    pDataUser->sPhaseC.sBackHaveDemand.hh,
                    pDataUser->sPhaseC.sBackHaveDemand.mm,
                    pDataUser->sPhaseC.sNoneDemandQuad1.fXX_XXXX,
                    pDataUser->sPhaseC.sNoneDemandQuad1.YY,
                    pDataUser->sPhaseC.sNoneDemandQuad1.MM,
                    pDataUser->sPhaseC.sNoneDemandQuad1.DD,
                    pDataUser->sPhaseC.sNoneDemandQuad1.hh,
                    pDataUser->sPhaseC.sNoneDemandQuad1.mm,
                    pDataUser->sPhaseC.sNoneDemandQuad2.fXX_XXXX,
                    pDataUser->sPhaseC.sNoneDemandQuad2.YY,
                    pDataUser->sPhaseC.sNoneDemandQuad2.MM,
                    pDataUser->sPhaseC.sNoneDemandQuad2.DD,
                    pDataUser->sPhaseC.sNoneDemandQuad2.hh,
                    pDataUser->sPhaseC.sNoneDemandQuad2.mm,
                    pDataUser->sPhaseC.sNoneDemandQuad3.fXX_XXXX,
                    pDataUser->sPhaseC.sNoneDemandQuad3.YY,
                    pDataUser->sPhaseC.sNoneDemandQuad3.MM,
                    pDataUser->sPhaseC.sNoneDemandQuad3.DD,
                    pDataUser->sPhaseC.sNoneDemandQuad3.hh,
                    pDataUser->sPhaseC.sNoneDemandQuad3.mm,
                    pDataUser->sPhaseC.sNoneDemandQuad4.fXX_XXXX,
                    pDataUser->sPhaseC.sNoneDemandQuad4.YY,
                    pDataUser->sPhaseC.sNoneDemandQuad4.MM,
                    pDataUser->sPhaseC.sNoneDemandQuad4.DD,
                    pDataUser->sPhaseC.sNoneDemandQuad4.hh,
                    pDataUser->sPhaseC.sNoneDemandQuad4.mm);
        }
        #endif
    }
#endif

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_meter_clear
 功能描述  : 电表清零事件数据结构
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月23日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_meter_clear(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventMeterClear *pDataUser = NULL;
    char strUsr[300] = {0};
    char strBcd[300] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    pDataUser = (S_CJT188_EventMeterClear *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            S_CJT188_EventMeterClear sTest ;
            pDataUser = (S_CJT188_EventMeterClear*)&sTest;
            //sOccurTime
            sTest.sOccurTime.YY = 0x07;
            sTest.sOccurTime.MM = 0x07;
            sTest.sOccurTime.DD = 0x07;
            sTest.sOccurTime.hh = 0x07;
            sTest.sOccurTime.mm = 0x07;
            sTest.sOccurTime.ss = 0x07;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;
            //sTotal
            sTest.sTotal.dForthHavePower = 123456.78;
            sTest.sTotal.dBackHavePower  = 123456.78;
            sTest.sTotal.dNonePowerQuad1 = 123456.78;
            sTest.sTotal.dNonePowerQuad2 = 123456.78;
            sTest.sTotal.dNonePowerQuad3 = 123456.78;
            sTest.sTotal.dNonePowerQuad4 = 123456.78;
            //sPhaseA
            sTest.sPhaseA.dForthHavePower = 123456.78;
            sTest.sPhaseA.dBackHavePower  = 123456.78;
            sTest.sPhaseA.dNonePowerQuad1 = 123456.78;
            sTest.sPhaseA.dNonePowerQuad2 = 123456.78;
            sTest.sPhaseA.dNonePowerQuad3 = 123456.78;
            sTest.sPhaseA.dNonePowerQuad4 = 123456.78;
            //sPhaseB
            sTest.sPhaseB.dForthHavePower = 123456.78;
            sTest.sPhaseB.dBackHavePower  = 123456.78;
            sTest.sPhaseB.dNonePowerQuad1 = 123456.78;
            sTest.sPhaseB.dNonePowerQuad2 = 123456.78;
            sTest.sPhaseB.dNonePowerQuad3 = 123456.78;
            sTest.sPhaseB.dNonePowerQuad4 = 123456.78;
            //sPhaseC
            sTest.sPhaseC.dForthHavePower = 123456.78;
            sTest.sPhaseC.dBackHavePower  = 123456.78;
            sTest.sPhaseC.dNonePowerQuad1 = 123456.78;
            sTest.sPhaseC.dNonePowerQuad2 = 123456.78;
            sTest.sPhaseC.dNonePowerQuad3 = 123456.78;
            sTest.sPhaseC.dNonePowerQuad4 = 123456.78;

        }
        #endif
        
        /* start time  字节总长 297*/
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"                     //sOccurTime
                        "%02d%02d%02d%02d"                            //operator
                        "%09.2f%09.2f%09.2f%09.2f%09.2f%09.2f"        //sTotal
                        "%09.2f%09.2f%09.2f%09.2f%09.2f%09.2f"        //sPhaseA
                        "%09.2f%09.2f%09.2f%09.2f%09.2f%09.2f"        //sPhaseB
                        "%09.2f%09.2f%09.2f%09.2f%09.2f%09.2f",        //sPhaseC        
                        //sBgnTime
                        pDataUser->sOccurTime.YY,
                        pDataUser->sOccurTime.MM,
                        pDataUser->sOccurTime.DD,    
                        pDataUser->sOccurTime.hh,
                        pDataUser->sOccurTime.mm,
                        pDataUser->sOccurTime.ss,
                        //operator
                        pDataUser->operator[0],
                        pDataUser->operator[1],
                        pDataUser->operator[2],
                        pDataUser->operator[3],
                        //sTotal
                        pDataUser->sTotal.dForthHavePower,
                        pDataUser->sTotal.dBackHavePower,
                        pDataUser->sTotal.dNonePowerQuad1,
                        pDataUser->sTotal.dNonePowerQuad2,
                        pDataUser->sTotal.dNonePowerQuad3,
                        pDataUser->sTotal.dNonePowerQuad4,
                        //sPhaseA
                        pDataUser->sPhaseA.dForthHavePower,
                        pDataUser->sPhaseA.dBackHavePower,
                        pDataUser->sPhaseA.dNonePowerQuad1,
                        pDataUser->sPhaseA.dNonePowerQuad2,
                        pDataUser->sPhaseA.dNonePowerQuad3,
                        pDataUser->sPhaseA.dNonePowerQuad4,
                        //sPhaseB
                        pDataUser->sPhaseB.dForthHavePower,
                        pDataUser->sPhaseB.dBackHavePower,
                        pDataUser->sPhaseB.dNonePowerQuad1,
                        pDataUser->sPhaseB.dNonePowerQuad2,
                        pDataUser->sPhaseB.dNonePowerQuad3,
                        pDataUser->sPhaseB.dNonePowerQuad4,
                        //sPhaseC
                        pDataUser->sPhaseC.dForthHavePower,
                        pDataUser->sPhaseC.dBackHavePower,
                        pDataUser->sPhaseC.dNonePowerQuad1,
                        pDataUser->sPhaseC.dNonePowerQuad2,
                        pDataUser->sPhaseC.dNonePowerQuad3,
                        pDataUser->sPhaseC.dNonePowerQuad4);
        
        cjt188_remove_dot(CJT188_DATA_LEN_RECD_METER_CLEAR  * 2,strUsr, strBcd);
        cjt188_str2bcd(strBcd, (UINT8*)frame, CJT188_DATA_LEN_RECD_METER_CLEAR *2);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, CJT188_DATA_LEN_RECD_METER_CLEAR);
        //sBgnTime
        pDataUser->sOccurTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sOccurTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sEndTime
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sTotal
        pDataUser->sTotal.dForthHavePower= cjt188_str_to_double(&strUsr[i+=2], 8, 6);
        pDataUser->sTotal.dBackHavePower = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sTotal.dNonePowerQuad1= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sTotal.dNonePowerQuad2= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sTotal.dNonePowerQuad3= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sTotal.dNonePowerQuad4= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPhaseA
        pDataUser->sPhaseA.dForthHavePower= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseA.dBackHavePower = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseA.dNonePowerQuad1= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseA.dNonePowerQuad2= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseA.dNonePowerQuad3= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseA.dNonePowerQuad4= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPhaseB
        pDataUser->sPhaseB.dForthHavePower= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseB.dBackHavePower = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseB.dNonePowerQuad1= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseB.dNonePowerQuad2= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseB.dNonePowerQuad3= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseB.dNonePowerQuad4= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPhaseC
        pDataUser->sPhaseC.dForthHavePower= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseC.dBackHavePower = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseC.dNonePowerQuad1= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseC.dNonePowerQuad2= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseC.dNonePowerQuad3= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPhaseC.dNonePowerQuad4= cjt188_str_to_double(&strUsr[i+=8], 8, 6);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "sBgnTime = %02d%02d%02d%02d%02d%02d\n"                 //sBgnTime
                    "operator = %02d%02d%02d%02d\n"                            //operator
                    "sTotal  = %09.2f %09.2f %09.2f %09.2f %09.2f %09.2f\n"    //sPowerTotal
                    "sPhaseA = %09.2f %09.2f %09.2f% 09.2f %09.2f %09.2f\n"    //sPowerA
                    "sPhaseB = %09.2f %09.2f %09.2f %09.2f %09.2f %09.2f\n"    //sPowerB
                    "sPhaseC = %09.2f %09.2f %09.2f %09.2f %09.2f %09.2f\n",//sPowerC
                    //sBgnTime
                    pDataUser->sOccurTime.YY,
                    pDataUser->sOccurTime.MM,
                    pDataUser->sOccurTime.DD,    
                    pDataUser->sOccurTime.hh,
                    pDataUser->sOccurTime.mm,
                    pDataUser->sOccurTime.ss,
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],
                    //sTotal
                    pDataUser->sTotal.dForthHavePower,
                    pDataUser->sTotal.dBackHavePower ,
                    pDataUser->sTotal.dNonePowerQuad1,
                    pDataUser->sTotal.dNonePowerQuad2,
                    pDataUser->sTotal.dNonePowerQuad3,
                    pDataUser->sTotal.dNonePowerQuad4,
                    //sPhaseA
                    pDataUser->sPhaseA.dForthHavePower,
                    pDataUser->sPhaseA.dBackHavePower ,
                    pDataUser->sPhaseA.dNonePowerQuad1,
                    pDataUser->sPhaseA.dNonePowerQuad2,
                    pDataUser->sPhaseA.dNonePowerQuad3,
                    pDataUser->sPhaseA.dNonePowerQuad4,
                    //sPhaseB
                    pDataUser->sPhaseB.dForthHavePower,
                    pDataUser->sPhaseB.dBackHavePower ,
                    pDataUser->sPhaseB.dNonePowerQuad1,
                    pDataUser->sPhaseB.dNonePowerQuad2,
                    pDataUser->sPhaseB.dNonePowerQuad3,
                    pDataUser->sPhaseB.dNonePowerQuad4,
                    //sPhaseC
                    pDataUser->sPhaseC.dForthHavePower,
                    pDataUser->sPhaseC.dBackHavePower ,
                    pDataUser->sPhaseC.dNonePowerQuad1,
                    pDataUser->sPhaseC.dNonePowerQuad2,
                    pDataUser->sPhaseC.dNonePowerQuad3,
                    pDataUser->sPhaseC.dNonePowerQuad4);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_meter_prog
 功能描述  : 编程记录数据结构转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月23日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_meter_prog(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventMeterProgram *pDataUser = NULL;
    char str[256] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    
    pDataUser = (S_CJT188_EventMeterProgram *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            pDataUser->sProgTime.YY  = 0x11;
            pDataUser->sProgTime.MM  = 0x11;
            pDataUser->sProgTime.DD  = 0x11;
            pDataUser->sProgTime.hh  = 0x11;
            pDataUser->sProgTime.mm  = 0x11;
            pDataUser->sProgTime.ss  = 0x11;
            pDataUser->programer[0]  = 'A';
            pDataUser->programer[1]  = 'B';
            pDataUser->programer[2]  = 'C';
            pDataUser->programer[3]  = 'D';
            pDataUser->ulRulerID[0]  = 0x12345678;
            pDataUser->ulRulerID[1]  = 0x12345678;
            pDataUser->ulRulerID[2]  = 0x12345678;
            pDataUser->ulRulerID[3]  = 0x12345678;
            pDataUser->ulRulerID[4]  = 0x12345678;
            pDataUser->ulRulerID[5]  = 0x12345678;
            pDataUser->ulRulerID[6]  = 0x12345678;
            pDataUser->ulRulerID[7]  = 0x12345678;
            pDataUser->ulRulerID[8]  = 0x12345678;
            pDataUser->ulRulerID[9]  = 0x12345678;
        }
        #endif
        sprintf(str,
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d"
                "%08X%08X%08X%08X%08X"
                "%08X%08X%08X%08X%08X",
                pDataUser->sProgTime.YY,
                pDataUser->sProgTime.MM,
                pDataUser->sProgTime.DD,
                pDataUser->sProgTime.hh,
                pDataUser->sProgTime.mm,
                pDataUser->sProgTime.ss,
                (UINT32)pDataUser->programer[0],
                (UINT32)pDataUser->programer[1],
                (UINT32)pDataUser->programer[2],
                (UINT32)pDataUser->programer[3],
                (UINT32)pDataUser->ulRulerID[0],
                (UINT32)pDataUser->ulRulerID[1],
                (UINT32)pDataUser->ulRulerID[2],
                (UINT32)pDataUser->ulRulerID[3],
                (UINT32)pDataUser->ulRulerID[4],
                (UINT32)pDataUser->ulRulerID[5],
                (UINT32)pDataUser->ulRulerID[6],
                (UINT32)pDataUser->ulRulerID[7],
                (UINT32)pDataUser->ulRulerID[8],
                (UINT32)pDataUser->ulRulerID[9]);
        cjt188_str2bcd(str, (UINT8*)frame, CJT188_DATA_LEN_METER_PROG * 2);
        
    }
    else// frame to user interface
    {

        cjt188_bcd2str(frame,  str, CJT188_DATA_LEN_METER_PROG);
        pDataUser->sProgTime.YY = cjt188_str_to_num(&str[i], 2);
        pDataUser->sProgTime.MM = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sProgTime.DD = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sProgTime.hh = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sProgTime.mm = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->sProgTime.ss = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->programer[0] = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->programer[1] = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->programer[2] = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->programer[3] = cjt188_str_to_num(&str[i+=2], 2);
        pDataUser->ulRulerID[0] = (UINT32)cjt188_hex_str_to_long(&str[i+=2], 8);
        pDataUser->ulRulerID[1] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);
        pDataUser->ulRulerID[2] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);
        pDataUser->ulRulerID[3] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);
        pDataUser->ulRulerID[4] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);
        pDataUser->ulRulerID[5] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);
        pDataUser->ulRulerID[6] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);
        pDataUser->ulRulerID[7] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);
        pDataUser->ulRulerID[8] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);
        pDataUser->ulRulerID[9] = (UINT32)cjt188_hex_str_to_long(&str[i+=8], 8);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "sProgTime = %02d%02d%02d%02d%02d%02d\n"
                    "programer = %c%c%c%c\n"
                    "uRulerID[0~9]\n%08X\n%08X\n%08X\n%08X\n%08X\n%08X\n%08X\n%08X\n%08X\n%08X\n",
                    pDataUser->sProgTime.YY,
                    pDataUser->sProgTime.MM,
                    pDataUser->sProgTime.DD,
                    pDataUser->sProgTime.hh,
                    pDataUser->sProgTime.mm,
                    pDataUser->sProgTime.ss,
                    (UINT32)pDataUser->programer[0],
                    (UINT32)pDataUser->programer[1],
                    (UINT32)pDataUser->programer[2],
                    (UINT32)pDataUser->programer[3],
                    (UINT32)pDataUser->ulRulerID[0],
                    (UINT32)pDataUser->ulRulerID[1],
                    (UINT32)pDataUser->ulRulerID[2],
                    (UINT32)pDataUser->ulRulerID[3],
                    (UINT32)pDataUser->ulRulerID[4],
                    (UINT32)pDataUser->ulRulerID[5],
                    (UINT32)pDataUser->ulRulerID[6],
                    (UINT32)pDataUser->ulRulerID[7],
                    (UINT32)pDataUser->ulRulerID[8],
                    (UINT32)pDataUser->ulRulerID[9]);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_volt_pass_percent
 功能描述  : 合格率事件数据结构
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月23日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_volt_pass_percent(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventPassPercent *pDataUser = NULL;
    INT32 nLenBCD = 27;
    INT32 nLenBcdStr = nLenBCD * 2;
    INT32 i = 0;
    char strUsr[300] = {0};
    char strBcd[300] = {0};
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventPassPercent *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            S_CJT188_EventPassPercent sTest ;
            pDataUser = (S_CJT188_EventPassPercent*)&sTest;

            sTest.ulMonitorVoltMinutes             = 111111;      //XXXXXX
            sTest.fVoltPassPercent                   = 1234.56;     //xxxx.xx            
            sTest.fVoltOverLimitPercent         = 1234.56;     //xxxx.xx    
            sTest.ulVoltOverUpperLimitMinutes     = 111111;    //XXXXXX
            sTest.ulVoltOverLowerLimitMinutes     = 111111;    //XXXXXX
            sTest.fVoltValueMax                 = 123.4;    //XXX.X
            sTest.sTimeVoltValueMax.MM             = 0x07;
            sTest.sTimeVoltValueMax.DD             = 0x07;
            sTest.sTimeVoltValueMax.hh             = 0x07;
            sTest.sTimeVoltValueMax.mm             = 0x07;
            sTest.fVoltValueMin                     = 123.4;    //XXX.X
            sTest.sTimeVoltValueMin.MM             = 0x07;
            sTest.sTimeVoltValueMin.DD             = 0x07;
            sTest.sTimeVoltValueMin.hh             = 0x07;
            sTest.sTimeVoltValueMin.mm             = 0x07;

        }
        #endif
        
        sprintf(strUsr, "%06d%06.2f%06.2f%06d%06d%04.1f%02d%02d%02d%02d%04.1f%02d%02d%02d%02d",        
                        (UINT32)pDataUser->ulMonitorVoltMinutes,
                        pDataUser->fVoltPassPercent,
                        pDataUser->fVoltOverLimitPercent,    
                        (UINT32)pDataUser->ulVoltOverUpperLimitMinutes,
                        (UINT32)pDataUser->ulVoltOverLowerLimitMinutes,
                        pDataUser->fVoltValueMax,
                        pDataUser->sTimeVoltValueMax.MM,
                        pDataUser->sTimeVoltValueMax.DD,
                        pDataUser->sTimeVoltValueMax.hh,
                        pDataUser->sTimeVoltValueMax.mm,
                        pDataUser->fVoltValueMin,
                        pDataUser->sTimeVoltValueMin.MM,
                        pDataUser->sTimeVoltValueMin.DD,
                        pDataUser->sTimeVoltValueMin.hh,
                        pDataUser->sTimeVoltValueMin.mm);
        cjt188_remove_dot(nLenBcdStr, strUsr, strBcd);
        cjt188_str2bcd(strBcd, (UINT8*)frame, nLenBcdStr);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, nLenBCD);

        pDataUser->ulMonitorVoltMinutes         = cjt188_str_to_num(&strUsr[0], 6);
        pDataUser->fVoltPassPercent             = cjt188_str_to_double(&strUsr[i+=6], 6, 4);
        pDataUser->fVoltOverLimitPercent        = cjt188_str_to_double(&strUsr[i+=6], 6, 4);
        pDataUser->ulVoltOverUpperLimitMinutes  = cjt188_str_to_num(&strUsr[i+=6], 6);
        pDataUser->ulVoltOverLowerLimitMinutes    = cjt188_str_to_num(&strUsr[i+=6], 6);
        pDataUser->fVoltValueMax                = cjt188_str_to_double(&strUsr[i+=6], 4, 3);
        pDataUser->sTimeVoltValueMax.MM            = cjt188_str_to_num(&strUsr[i+=4], 2);
        pDataUser->sTimeVoltValueMax.DD            = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTimeVoltValueMax.hh            = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTimeVoltValueMax.mm            = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->fVoltValueMin                = cjt188_str_to_double(&strUsr[i+=2], 4, 3);
        pDataUser->sTimeVoltValueMin.MM            = cjt188_str_to_num(&strUsr[i+=4], 2);
        pDataUser->sTimeVoltValueMin.DD            = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTimeVoltValueMin.hh            = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sTimeVoltValueMin.mm            = cjt188_str_to_num(&strUsr[i+=2], 2);

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    " XXXXXX  = %06d\n"
                    " XXXX.XX = %06.2f\n"
                    " XXXX.XX = %06.2f\n"
                    " XXXXXX  = %06d\n"
                    " XXXXXX  = %06d\n"
                    " XXX.X   = %04.1f\n"
                    " MM      = %02d\n"
                    " DD      = %02d\n"
                    " hh      = %02d\n"
                    " ss      = %02d\n"
                    " XXX.X   = %04.1f\n"
                    " MM      = %02d\n"
                    " DD      = %02d\n"
                    " hh      = %02d\n"
                    " ss      = %02d\n",        
                    (UINT32)pDataUser->ulMonitorVoltMinutes,
                    pDataUser->fVoltPassPercent,
                    pDataUser->fVoltOverLimitPercent,    
                    (UINT32)pDataUser->ulVoltOverUpperLimitMinutes,
                    (UINT32)pDataUser->ulVoltOverLowerLimitMinutes,
                    pDataUser->fVoltValueMax,
                    pDataUser->sTimeVoltValueMax.MM,
                    pDataUser->sTimeVoltValueMax.DD,
                    pDataUser->sTimeVoltValueMax.hh,
                    pDataUser->sTimeVoltValueMax.mm,
                    pDataUser->fVoltValueMin,
                    pDataUser->sTimeVoltValueMin.MM,
                    pDataUser->sTimeVoltValueMin.DD,
                    pDataUser->sTimeVoltValueMin.hh,
                    pDataUser->sTimeVoltValueMin.mm);
        }
        #endif
    }

    return E_CJT188_OK;
}
/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_weekday_prog
 功能描述  : 周休日编程事件记录数据结构转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月26日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_weekday_prog(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventWeekDay *pDataUser = NULL;
    char strUsr[64] = {0};
    INT32 i = 0;
    
    #ifdef CJT188_DEBUG_ON
    S_CJT188_EventWeekDay sTest ;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventWeekDay *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            
            pDataUser = (S_CJT188_EventWeekDay*)&sTest;
            //sOccurTime
            sTest.sOccurTime.YY = 0x07;
            sTest.sOccurTime.MM = 0x07;
            sTest.sOccurTime.DD = 0x07;
            sTest.sOccurTime.hh = 0x07;
            sTest.sOccurTime.mm = 0x07;
            sTest.sOccurTime.ss = 0x07;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;
            //sTotal
            sTest.ucTableNum =  0x12;
        }
        #endif
        
        /* start time  字节总长 297*/
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"                     //sOccurTime
                        "%02d%02d%02d%02d"                            //operator
                        //ulEventID
                        "%02d",                
                        //sBgnTime
                        pDataUser->sOccurTime.YY,
                        pDataUser->sOccurTime.MM,
                        pDataUser->sOccurTime.DD,    
                        pDataUser->sOccurTime.hh,
                        pDataUser->sOccurTime.mm,
                        pDataUser->sOccurTime.ss,
                        //operator
                        pDataUser->operator[0],
                        pDataUser->operator[1],
                        pDataUser->operator[2],
                        pDataUser->operator[3],
                        //ucTableNum
                        pDataUser->ucTableNum);
        
        cjt188_str2bcd(strUsr, (UINT8*)frame, 22);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, 11);

        //sOccurTime
        pDataUser->sOccurTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sOccurTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //operator
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        //ulEventID
        pDataUser->ucTableNum = cjt188_str_to_num(&strUsr[i+=2], 2);
        
        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "OccurTime = %02d%02d%02d%02d%02d%02d\n" //sOccurTime
                    "operator %02d%02d%02d%02d\n"             //operator
                    //sTotal
                    "sTotal = 0x%02X\n",    
                    //sOccurTime
                    pDataUser->sOccurTime.YY,
                    pDataUser->sOccurTime.MM,
                    pDataUser->sOccurTime.DD,    
                    pDataUser->sOccurTime.hh,
                    pDataUser->sOccurTime.mm,
                    pDataUser->sOccurTime.ss,
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],
                    //sTotal
                    pDataUser->ucTableNum);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_holiday_prog
 功能描述  : 节假日编程事件记录转换
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月26日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_holiday_prog(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventHoliday *pDataUser = NULL;
    char strUsr[175] = {0};
    INT32 j = 0;
    INT32 i = 0;    
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventHoliday *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            S_CJT188_EventHoliday sTest ;
            pDataUser = (S_CJT188_EventHoliday*)&sTest;
            //sOccurTime
            sTest.sOccurTime.YY = 0x07;
            sTest.sOccurTime.MM = 0x07;
            sTest.sOccurTime.DD = 0x07;
            sTest.sOccurTime.hh = 0x07;
            sTest.sOccurTime.mm = 0x07;
            sTest.sOccurTime.ss = 0x07;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;
            //sTotal
            INT32 i;
            for(i = 0; i < 12; i++)
            {
                sTest.sHoliday[i].YY = i;
                sTest.sHoliday[i].MM = i+1;
                sTest.sHoliday[i].DD = i+2;
                sTest.sHoliday[i].NN = i+3;
            }
        }
        #endif
        
        /* start time  字节总长 297*/
        snprintf(strUsr,  sizeof(strUsr),
                "%02d%02d%02d%02d%02d%02d"                     //sOccurTime
                "%02d%02d%02d%02d"                            //operator
                //sHoliday
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d%02d%02d"
                "%02d%02d%02d%02d%02d%02d",                
                //sBgnTime
                pDataUser->sOccurTime.YY,
                pDataUser->sOccurTime.MM,
                pDataUser->sOccurTime.DD,    
                pDataUser->sOccurTime.hh,
                pDataUser->sOccurTime.mm,
                pDataUser->sOccurTime.ss,
                //operator
                pDataUser->operator[0],
                pDataUser->operator[1],
                pDataUser->operator[2],
                pDataUser->operator[3],
                //sHoliday
                pDataUser->sHoliday[0].YY,
                pDataUser->sHoliday[0].MM,
                pDataUser->sHoliday[0].DD,
                pDataUser->sHoliday[0].NN,
                pDataUser->sHoliday[1].YY,
                pDataUser->sHoliday[1].MM,
                pDataUser->sHoliday[1].DD,
                pDataUser->sHoliday[1].NN,
                pDataUser->sHoliday[2].YY,
                pDataUser->sHoliday[2].MM,
                pDataUser->sHoliday[2].DD,
                pDataUser->sHoliday[2].NN,
                pDataUser->sHoliday[3].YY,
                pDataUser->sHoliday[3].MM,
                pDataUser->sHoliday[3].DD,
                pDataUser->sHoliday[3].NN,
                pDataUser->sHoliday[4].YY,
                pDataUser->sHoliday[4].MM,
                pDataUser->sHoliday[4].DD,
                pDataUser->sHoliday[4].NN,
                pDataUser->sHoliday[5].YY,
                pDataUser->sHoliday[5].MM,
                pDataUser->sHoliday[5].DD,
                pDataUser->sHoliday[5].NN,
                pDataUser->sHoliday[6].YY,
                pDataUser->sHoliday[6].MM,
                pDataUser->sHoliday[6].DD,
                pDataUser->sHoliday[6].NN,
                pDataUser->sHoliday[7].YY,
                pDataUser->sHoliday[7].MM,
                pDataUser->sHoliday[7].DD,
                pDataUser->sHoliday[7].NN,
                pDataUser->sHoliday[8].YY,
                pDataUser->sHoliday[8].MM,
                pDataUser->sHoliday[8].DD,
                pDataUser->sHoliday[8].NN,
                pDataUser->sHoliday[9].YY,
                pDataUser->sHoliday[9].MM,
                pDataUser->sHoliday[9].DD,
                pDataUser->sHoliday[9].NN,
                pDataUser->sHoliday[10].YY,
                pDataUser->sHoliday[10].MM,
                pDataUser->sHoliday[10].DD,
                pDataUser->sHoliday[10].NN,
                pDataUser->sHoliday[11].YY,
                pDataUser->sHoliday[11].MM,
                pDataUser->sHoliday[11].DD,
                pDataUser->sHoliday[11].NN);
        
        cjt188_str2bcd(strUsr, (UINT8*)frame, 106);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, 58);

        //sOccurTime
        pDataUser->sOccurTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sOccurTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //operator
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        //ulEventID
        for(j = 0; j < 11; j++)
        {
            pDataUser->operator[j] = cjt188_str_to_num(&strUsr[i+=2], 2);
        }
        
        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "sOccurTime = %02d%02d%02d%02d%02d%02d\n"                     //sOccurTime
                    "operator = %02d%02d%02d%02d\n"                            //operator
                    //sHoliday
                    "%02d%02d%02d%02d%02d%02d"
                    "%02d%02d%02d%02d%02d%02d"
                    "%02d%02d%02d%02d%02d%02d"
                    "%02d%02d%02d%02d%02d%02d"
                    "%02d%02d%02d%02d%02d%02d"
                    "%02d%02d%02d%02d%02d%02d"
                    "%02d%02d%02d%02d%02d%02d"
                    "%02d%02d%02d%02d%02d%02d",                
                    //sBgnTime
                    pDataUser->sOccurTime.YY,
                    pDataUser->sOccurTime.MM,
                    pDataUser->sOccurTime.DD,    
                    pDataUser->sOccurTime.hh,
                    pDataUser->sOccurTime.mm,
                    pDataUser->sOccurTime.ss,
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],
                    //sHoliday
                    pDataUser->sHoliday[0].YY,
                    pDataUser->sHoliday[0].MM,
                    pDataUser->sHoliday[0].DD,
                    pDataUser->sHoliday[0].NN,
                    pDataUser->sHoliday[1].YY,
                    pDataUser->sHoliday[1].MM,
                    pDataUser->sHoliday[1].DD,
                    pDataUser->sHoliday[1].NN,
                    pDataUser->sHoliday[2].YY,
                    pDataUser->sHoliday[2].MM,
                    pDataUser->sHoliday[2].DD,
                    pDataUser->sHoliday[2].NN,
                    pDataUser->sHoliday[3].YY,
                    pDataUser->sHoliday[3].MM,
                    pDataUser->sHoliday[3].DD,
                    pDataUser->sHoliday[3].NN,
                    pDataUser->sHoliday[4].YY,
                    pDataUser->sHoliday[4].MM,
                    pDataUser->sHoliday[4].DD,
                    pDataUser->sHoliday[4].NN,
                    pDataUser->sHoliday[5].YY,
                    pDataUser->sHoliday[5].MM,
                    pDataUser->sHoliday[5].DD,
                    pDataUser->sHoliday[5].NN,
                    pDataUser->sHoliday[6].YY,
                    pDataUser->sHoliday[6].MM,
                    pDataUser->sHoliday[6].DD,
                    pDataUser->sHoliday[6].NN,
                    pDataUser->sHoliday[7].YY,
                    pDataUser->sHoliday[7].MM,
                    pDataUser->sHoliday[7].DD,
                    pDataUser->sHoliday[7].NN,
                    pDataUser->sHoliday[8].YY,
                    pDataUser->sHoliday[8].MM,
                    pDataUser->sHoliday[8].DD,
                    pDataUser->sHoliday[8].NN,
                    pDataUser->sHoliday[9].YY,
                    pDataUser->sHoliday[9].MM,
                    pDataUser->sHoliday[9].DD,
                    pDataUser->sHoliday[9].NN,
                    pDataUser->sHoliday[10].YY,
                    pDataUser->sHoliday[10].MM,
                    pDataUser->sHoliday[10].DD,
                    pDataUser->sHoliday[10].NN,
                    pDataUser->sHoliday[11].YY,
                    pDataUser->sHoliday[11].MM,
                    pDataUser->sHoliday[11].DD,
                    pDataUser->sHoliday[11].NN);
        }
        #endif
    }

    return E_CJT188_OK;
}


/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_power_prog
 功能描述  : 组合有功无功编程事件结构
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月27日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_power_prog(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventCombPower *pDataUser = NULL;
    char strUsr[64] = {0};
    INT32 i = 0;

    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventCombPower *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            S_CJT188_EventCombPower sTest ;
            pDataUser = (S_CJT188_EventCombPower*)&sTest;
            //sOccurTime
            sTest.sOccurTime.YY = 0x07;
            sTest.sOccurTime.MM = 0x07;
            sTest.sOccurTime.DD = 0x07;
            sTest.sOccurTime.hh = 0x07;
            sTest.sOccurTime.mm = 0x07;
            sTest.sOccurTime.ss = 0x07;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;
            //ucWord
            sTest.ucWord =  0x12;
        }
        #endif
        
        /* start time  字节总长 297*/
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"                     //sOccurTime
                        "%02d%02d%02d%02d"                            //operator
                        //ulEventID
                        "%02d",                
                        //sBgnTime
                        pDataUser->sOccurTime.YY,
                        pDataUser->sOccurTime.MM,
                        pDataUser->sOccurTime.DD,    
                        pDataUser->sOccurTime.hh,
                        pDataUser->sOccurTime.mm,
                        pDataUser->sOccurTime.ss,
                        //operator
                        pDataUser->operator[0],
                        pDataUser->operator[1],
                        pDataUser->operator[2],
                        pDataUser->operator[3],
                        //ucWord
                        pDataUser->ucWord);
        
        cjt188_str2bcd(strUsr, (UINT8*)frame, 22);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, 11);

        //sOccurTime
        pDataUser->sOccurTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sOccurTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //operator
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        //ucWord
        pDataUser->ucWord = cjt188_str_to_num(&strUsr[i+=2], 2);
        

        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "OccurTime = %02d%02d%02d%02d%02d%02d\n" //sOccurTime
                    "operator %02d%02d%02d%02d\n"             //operator
                    //sTotal
                    "sTotal = 0x%02X\n",    
                    //sOccurTime
                    pDataUser->sOccurTime.YY,
                    pDataUser->sOccurTime.MM,
                    pDataUser->sOccurTime.DD,    
                    pDataUser->sOccurTime.hh,
                    pDataUser->sOccurTime.mm,
                    pDataUser->sOccurTime.ss,
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],
                    //sTotal
                    pDataUser->ucWord);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_payoff_prog
 功能描述  : 结算日编程事件记录
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月27日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_payoff_prog(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventPayoff *pDataUser = NULL;
    char strUsr[64] = {0};
    INT32 i = 0;
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventPayoff *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            S_CJT188_EventPayoff sTest ;
            pDataUser = (S_CJT188_EventPayoff*)&sTest;
            //sOccurTime
            sTest.sOccurTime.YY = 0x07;
            sTest.sOccurTime.MM = 0x07;
            sTest.sOccurTime.DD = 0x07;
            sTest.sOccurTime.hh = 0x07;
            sTest.sOccurTime.mm = 0x07;
            sTest.sOccurTime.ss = 0x07;
            //operator
            sTest.operator[0] = 0x01;
            sTest.operator[1] = 0x02;
            sTest.operator[2] = 0x03;
            sTest.operator[3] = 0x04;
            //ucWord
            sTest.sDay1.DD =  0x12;
            sTest.sDay1.hh =  0x12;
            sTest.sDay2.DD =  0x12;
            sTest.sDay2.hh =  0x12;
            sTest.sDay3.DD =  0x12;
            sTest.sDay3.hh =  0x12;
        }
        #endif
        
        /* start time  字节总长 297*/
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"                     //sOccurTime
                        "%02d%02d%02d%02d"                            //operator
                        //ulEventID
                        "%02d%02d%02d%02d%02d%02d",                
                        //sBgnTime
                        pDataUser->sOccurTime.YY,
                        pDataUser->sOccurTime.MM,
                        pDataUser->sOccurTime.DD,    
                        pDataUser->sOccurTime.hh,
                        pDataUser->sOccurTime.mm,
                        pDataUser->sOccurTime.ss,
                        //operator
                        pDataUser->operator[0],
                        pDataUser->operator[1],
                        pDataUser->operator[2],
                        pDataUser->operator[3],
                        //ucWord
                        pDataUser->sDay1.DD,
                        pDataUser->sDay1.hh,
                        pDataUser->sDay2.DD,
                        pDataUser->sDay2.hh,
                        pDataUser->sDay3.DD,
                        pDataUser->sDay3.hh);
        
        cjt188_str2bcd(strUsr, (UINT8*)frame, 36);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, 18);
        //sOccurTime
        pDataUser->sOccurTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sOccurTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sOccurTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //operator
        pDataUser->operator[0] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[1] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[2] = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->operator[3] = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sDay1
        pDataUser->sDay1.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sDay1.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sDay2.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sDay2.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sDay3.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sDay3.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        
        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "OccurTime = %02d%02d%02d%02d%02d%02d\n" //sOccurTime
                    "operator %02d%02d%02d%02d\n"             //operator
                    //sTotal
                    "sDay1 = 0x%02X 0x%02X\n"
                    "sDay2 = 0x%02X 0x%02X\n"
                    "sDay3 = 0x%02X 0x%02X\n",    
                    //sOccurTime
                    pDataUser->sOccurTime.YY,
                    pDataUser->sOccurTime.MM,
                    pDataUser->sOccurTime.DD,    
                    pDataUser->sOccurTime.hh,
                    pDataUser->sOccurTime.mm,
                    pDataUser->sOccurTime.ss,
                    //operator
                    pDataUser->operator[0],
                    pDataUser->operator[1],
                    pDataUser->operator[2],
                    pDataUser->operator[3],
                    //sTotal
                    pDataUser->sDay1.DD,
                    pDataUser->sDay1.hh,
                    pDataUser->sDay2.DD,
                    pDataUser->sDay2.hh,
                    pDataUser->sDay3.DD,
                    pDataUser->sDay3.hh);
        }
        #endif
    }

    return E_CJT188_OK;
}

/*****************************************************************************
 函 数 名  : trans_cjt188_data_recd_open_meter_cap
 功能描述  : 电表开盖事件记录结构
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2012年11月27日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_recd_open_meter_cap(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    S_CJT188_EventOpenCap *pDataUser = NULL;
    char strUsr[300] = {0};
    char strBcd[300] = {0};
    INT32 i = 0;

    #ifdef CJT188_DEBUG_ON
    S_CJT188_EventOpenCap sTest ;
    #endif
    
    if(NULL == user || NULL == frame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    pDataUser = (S_CJT188_EventOpenCap *)user;
    
    if(E_CJT188_TRANS_U2F == flag)
    {
        //显示数据信息
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
        
            pDataUser = (S_CJT188_EventOpenCap*)&sTest;
            //sBgnTime
            sTest.sBgnTime.YY = 0x07;
            sTest.sBgnTime.MM = 0x07;
            sTest.sBgnTime.DD = 0x07;
            sTest.sBgnTime.hh = 0x07;
            sTest.sBgnTime.mm = 0x07;
            sTest.sBgnTime.ss = 0x07;
            //sBgnTime
            sTest.sEndTime.YY = 0x07;
            sTest.sEndTime.MM = 0x07;
            sTest.sEndTime.DD = 0x07;
            sTest.sEndTime.hh = 0x07;
            sTest.sEndTime.mm = 0x07;
            sTest.sEndTime.ss = 0x07;

            //sPowerBeforOpen
            sTest.sPowerBeforOpen.dForthHavePower = 123456.78;
            sTest.sPowerBeforOpen.dBackHavePower  = 123456.78;
            sTest.sPowerBeforOpen.dNonePowerQuad1 = 123456.78;
            sTest.sPowerBeforOpen.dNonePowerQuad2 = 123456.78;
            sTest.sPowerBeforOpen.dNonePowerQuad3 = 123456.78;
            sTest.sPowerBeforOpen.dNonePowerQuad4 = 123456.78;
            //sPowerAfterOpen
            sTest.sPowerAfterOpen.dForthHavePower = 123456.78;
            sTest.sPowerAfterOpen.dBackHavePower  = 123456.78;
            sTest.sPowerAfterOpen.dNonePowerQuad1 = 123456.78;
            sTest.sPowerAfterOpen.dNonePowerQuad2 = 123456.78;
            sTest.sPowerAfterOpen.dNonePowerQuad3 = 123456.78;
            sTest.sPowerAfterOpen.dNonePowerQuad4 = 123456.78;

        }
        #endif
        
        sprintf(strUsr, "%02d%02d%02d%02d%02d%02d"                     //sBgnTime
                        "%02d%02d%02d%02d%02d%02d"                     //sBgnTime
                        "%09.2f%09.2f%09.2f%09.2f%09.2f%09.2f"        //sTotal
                        "%09.2f%09.2f%09.2f%09.2f%09.2f%09.2f",        //sPhaseA
                        //sBgnTime
                        pDataUser->sBgnTime.YY,
                        pDataUser->sBgnTime.MM,
                        pDataUser->sBgnTime.DD,    
                        pDataUser->sBgnTime.hh,
                        pDataUser->sBgnTime.mm,
                        pDataUser->sBgnTime.ss,
                        //sEndTime
                        pDataUser->sEndTime.YY,
                        pDataUser->sEndTime.MM,
                        pDataUser->sEndTime.DD,    
                        pDataUser->sEndTime.hh,
                        pDataUser->sEndTime.mm,
                        pDataUser->sEndTime.ss,
                        //sPowerBeforOpen
                        pDataUser->sPowerBeforOpen.dForthHavePower,
                        pDataUser->sPowerBeforOpen.dBackHavePower,
                        pDataUser->sPowerBeforOpen.dNonePowerQuad1,
                        pDataUser->sPowerBeforOpen.dNonePowerQuad2,
                        pDataUser->sPowerBeforOpen.dNonePowerQuad3,
                        pDataUser->sPowerBeforOpen.dNonePowerQuad4,
                        //sPowerAfterOpen
                        pDataUser->sPowerAfterOpen.dForthHavePower,
                        pDataUser->sPowerAfterOpen.dBackHavePower,
                        pDataUser->sPowerAfterOpen.dNonePowerQuad1,
                        pDataUser->sPowerAfterOpen.dNonePowerQuad2,
                        pDataUser->sPowerAfterOpen.dNonePowerQuad3,
                        pDataUser->sPowerAfterOpen.dNonePowerQuad4);
        
        cjt188_remove_dot(120,strUsr, strBcd);
        cjt188_str2bcd(strBcd, (UINT8*)frame, 120);
        
    }
    else// frame to user interface
    {
        cjt188_bcd2str(frame, strUsr, 60);
        
        //sBgnTime
        pDataUser->sBgnTime.YY = cjt188_str_to_num(&strUsr[ i  ], 2);
        pDataUser->sBgnTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sBgnTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sBgnTime
        pDataUser->sEndTime.YY = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.MM = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.DD = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.hh = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.mm = cjt188_str_to_num(&strUsr[i+=2], 2);
        pDataUser->sEndTime.ss = cjt188_str_to_num(&strUsr[i+=2], 2);
        //sTotal
        pDataUser->sPowerBeforOpen.dForthHavePower= cjt188_str_to_double(&strUsr[i+=2], 8, 6);
        pDataUser->sPowerBeforOpen.dBackHavePower = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerBeforOpen.dNonePowerQuad1= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerBeforOpen.dNonePowerQuad2= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerBeforOpen.dNonePowerQuad3= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerBeforOpen.dNonePowerQuad4= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        //sPhaseA
        pDataUser->sPowerAfterOpen.dForthHavePower= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerAfterOpen.dBackHavePower = cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerAfterOpen.dNonePowerQuad1= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerAfterOpen.dNonePowerQuad2= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerAfterOpen.dNonePowerQuad3= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        pDataUser->sPowerAfterOpen.dNonePowerQuad4= cjt188_str_to_double(&strUsr[i+=8], 8, 6);
        
        //数据输出
        #ifdef CJT188_DEBUG_ON
        if(CJT188_ON == g_need_pack_07)
        {
            memset((void *)g_out_data_07, 0x00, OUT_BUF_LEN);
            sprintf(g_out_data_07, 
                    "sBgnTime = %02d%02d%02d%02d%02d%02d\n"                 //sBgnTime
                    "sBgnTime = %02d%02d%02d%02d%02d%02d\n"                 //sEndTime
                    "sPowerBeforOpen  = %09.2f %09.2f %09.2f %09.2f %09.2f %09.2f\n"    //sPowerBeforOpen
                    "sPowerAfterOpen  = %09.2f %09.2f %09.2f% 09.2f %09.2f %09.2f\n",    //sPowerAfterOpen
                    pDataUser->sBgnTime.YY,
                    pDataUser->sBgnTime.MM,
                    pDataUser->sBgnTime.DD,    
                    pDataUser->sBgnTime.hh,
                    pDataUser->sBgnTime.mm,
                    pDataUser->sBgnTime.ss,
                    //sEndTime
                    pDataUser->sEndTime.YY,
                    pDataUser->sEndTime.MM,
                    pDataUser->sEndTime.DD,    
                    pDataUser->sEndTime.hh,
                    pDataUser->sEndTime.mm,
                    pDataUser->sEndTime.ss,
                    //sPowerBeforOpen
                    pDataUser->sPowerBeforOpen.dForthHavePower,
                    pDataUser->sPowerBeforOpen.dBackHavePower,
                    pDataUser->sPowerBeforOpen.dNonePowerQuad1,
                    pDataUser->sPowerBeforOpen.dNonePowerQuad2,
                    pDataUser->sPowerBeforOpen.dNonePowerQuad3,
                    pDataUser->sPowerBeforOpen.dNonePowerQuad4,
                    //sPowerAfterOpen
                    pDataUser->sPowerAfterOpen.dForthHavePower,
                    pDataUser->sPowerAfterOpen.dBackHavePower,
                    pDataUser->sPowerAfterOpen.dNonePowerQuad1,
                    pDataUser->sPowerAfterOpen.dNonePowerQuad2,
                    pDataUser->sPowerAfterOpen.dNonePowerQuad3,
                    pDataUser->sPowerAfterOpen.dNonePowerQuad4);
        }
        #endif
    }

    return E_CJT188_OK;
}

// 同开表盖
eCJT188Err trans_cjt188_data_recd_open_btn_box(E_CJT188_TRANS_FLG flag, char *user, char *frame)    
{
    return trans_cjt188_data_recd_open_meter_cap(flag, user, frame);
}


/*****************************************************************************
 函 数 名  : trans_cjt188_data_err
 功能描述  : 错误状态字转换函数
 输入参数  : E_CJT188_TRANS_FLG flag  
             char *user            
             char *frame           
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2013年1月5日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
eCJT188Err trans_cjt188_data_err(E_CJT188_TRANS_FLG flag, char *user, char *frame)
{

    UINT8 *pucErr;
    UINT8 ucErr = 0;
    S_CJT188_ERR *psErr = NULL;

    if(!user || !frame)
    {
        return E_CJT188_ERRO_NULL;
    }

    psErr = (S_CJT188_ERR*)user;
    pucErr = (UINT8 *)frame;
        
    if(flag == E_CJT188_TRANS_U2F)
    {
    
        (psErr->bRateErr  == TRUE) ? (ucErr |= 0x40) : (ucErr &= 0xBF);
        (psErr->bDayErr   == TRUE) ? (ucErr |= 0x20) : (ucErr &= 0xDF);
        (psErr->bYearErr  == TRUE) ? (ucErr |= 0x10) : (ucErr &= 0xEF);
        (psErr->bCommErr  == TRUE) ? (ucErr |= 0x08) : (ucErr &= 0xF7);
        (psErr->bPwdErr   == TRUE) ? (ucErr |= 0x04) : (ucErr &= 0xFB);
        (psErr->bNoneReq  == TRUE) ? (ucErr |= 0x02) : (ucErr &= 0xFD);
        (psErr->bOtherErr == TRUE) ? (ucErr |= 0x01) : (ucErr &= 0xFE);

        *pucErr = ucErr;

        // 显示信息
    }
    else
    {
        ucErr = *(UINT8 *)frame;
        psErr->bRateErr  = (ucErr & 0x40) ? TRUE : FALSE;
        psErr->bDayErr   = (ucErr & 0x20) ? TRUE : FALSE;
        psErr->bYearErr  = (ucErr & 0x10) ? TRUE : FALSE;
        psErr->bCommErr  = (ucErr & 0x08) ? TRUE : FALSE;
        psErr->bPwdErr   = (ucErr & 0x04) ? TRUE : FALSE;
        psErr->bNoneReq  = (ucErr & 0x02) ? TRUE : FALSE;
        psErr->bOtherErr = (ucErr & 0x01) ? TRUE : FALSE;

        //显示信息
        #ifdef CJT188_DEBUG_ON
        sprintf(g_out_data_07, 
        "费率数超: \t%s\n"
        "日时段数超: \t%s\n"
        "年时区数超: \t%s\n"
        "通讯速率不能更改: \t%s\n"
        "密码错/未授权: \t%s\n"
        "无请求数据: \t%s\n"
        "其他错误: \t%s\n", 
        psErr->bRateErr  == TRUE ? "有" : "无",
        psErr->bDayErr   == TRUE ? "有" : "无",
        psErr->bYearErr  == TRUE ? "有" : "无",
        psErr->bCommErr  == TRUE ? "有" : "无",
        psErr->bPwdErr   == TRUE ? "有" : "无",
        psErr->bNoneReq  == TRUE ? "有" : "无",
        psErr->bOtherErr == TRUE ? "有" : "无");
        #endif
    }
    
    return E_CJT188_OK;
}



/*****************************************************************************
 函 数 名  : get_cjt188_first_valid_frame
 功能描述  : cjt188 2007 找到第一个有效帧的位置及长度
 输入参数  : const UINT8 *pBuf    
             UINT16 usLenBuf      
             UINT8  **ppFirstPos  
             UINT16 *pusLenFrame  
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2013年1月25日
    作    者   : liming
    修改内容   : 新生成函数

*****************************************************************************/
int get_cjt188_first_valid_frame(const UINT8 *pBuf,         // 要解析的buf
                              UINT16 usLenBuf,           // 要解析的buf字节数
                              UINT8  **ppFirstPos,       // 输出帧buffer
                              UINT16 *pusLenFrame)      // 输出Frame字节数
{

    int i = 0, j = 0;
    UINT16 usLenLeft = 0; // 循环检测之的长度
    UINT8 ucDataLen = 0;
    UINT8 ucCheckSum = 0;
    int nLen = 0;
    INT32 nCheckSumPosStart, nCheckSumPos, nEndPos;
    
    if(!pBuf || !ppFirstPos || !pusLenFrame)
    {
        return E_CJT188_ERRO_NULL;
    }
    
    for(i = 0; i < usLenBuf; i++)
    {
        usLenLeft = usLenBuf - i;

        if(usLenLeft < CJT188_FRAME_LEN_MIN)
        {
            return E_CJT188_ERRO_FRAME_UNCOMP;
        }

        if(pBuf[i] == 0x68)
        {
             nCheckSumPosStart = i;
             ucDataLen = pBuf[i+10];
             nLen = usLenLeft - 10 - ucDataLen;

             if(nLen < 0)
             {
                return E_CJT188_ERRO_FRAME_UNCOMP;
             }

             nCheckSumPos = nCheckSumPosStart + ucDataLen + 10;
             nEndPos = nCheckSumPos+1;

             // 计算校验和
             //查检checksum
            for(j = nCheckSumPosStart; j < nCheckSumPos; j++)
            {
                ucCheckSum +=  pBuf[j];
            }

            // 检查和出错
            if(ucCheckSum != pBuf[nCheckSumPos])
            {
                //return E_CJT188_ERRO_FRAME_CHECK_SUM;
                continue;
            }

            //结束符
            if(0x16 != pBuf[nEndPos])
            {
                //return E_CJT188_ERRO_FRAME_END_0x16;
                continue;
            }
            
            *ppFirstPos = (UINT8*)(pBuf + nCheckSumPosStart);
            *pusLenFrame = (UINT16)(ucDataLen + 12);
            return E_CJT188_OK;

          }
          
    }
    
    return E_CJT188_ERRO_NONE_FRAME;
}

